Re: [R] How to remove packages from the active working window

2013-01-26 Thread hp wan
Thanks a lot!

2013/1/27 David Winsemius 

>
> On Jan 26, 2013, at 6:26 PM, hp wan wrote:
>
>  Hi all mailing listers,
>>
>> My question is as follows:
>>
>> e.g.
>> I launched two packages, say packageA and packageB, but they have the
>> function of the same name, leading to masking. I want to remove the
>> packageA from the working window after using the packageA so as not to
>> causing problem. I do not want to carry out task each time using  packageA
>> and  packageB individually because many the tasks share many parameters.
>>
>> Any ideals and suggestion will be much appreciated.
>>
>
> Including some specifics would support a better answer. It is _sometimes_
> possible to detach a namespace. See:
>
> unloadNamespace
>
> If all you want to do is call a particular function in pkgA  which was
> masked by a more recently loaded package pckB, then you can call the
> desired function as:
>
> pkgA::func_name(args(
>
>
> --
>
> David Winsemius, MD
> Alameda, CA, USA
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to remove packages from the active working window

2013-01-26 Thread David Winsemius


On Jan 26, 2013, at 6:26 PM, hp wan wrote:


Hi all mailing listers,

My question is as follows:

e.g.
I launched two packages, say packageA and packageB, but they have the
function of the same name, leading to masking. I want to remove the
packageA from the working window after using the packageA so as not to
causing problem. I do not want to carry out task each time using   
packageA
and  packageB individually because many the tasks share many  
parameters.


Any ideals and suggestion will be much appreciated.


Including some specifics would support a better answer. It is  
_sometimes_ possible to detach a namespace. See:


unloadNamespace

If all you want to do is call a particular function in pkgA  which was  
masked by a more recently loaded package pckB, then you can call the  
desired function as:


pkgA::func_name(args(


--

David Winsemius, MD
Alameda, CA, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] decimal places in R2HTML

2013-01-26 Thread Joshua Wiley
 Realized I did not reply to this list.

On Sat, Jan 26, 2013 at 7:54 PM, Joshua Wiley  wrote:
>  Hi Erin,
>
> Most packages creating output for inclusion in pages, reports, books,
> etc. do some rounding as R's default level of printed precision tends
> to be overkill.  R2HTML is no different, but you can control this.  To
> see what it currently is:
>
> getOption("R2HTML.format.digits")
>
> and you can set it via:
>
> options("R2HTML.format.digits" = 4)
>
>
> after which, I get:
>
>> HTML(confint(aov(Sepal.Length ~ Species, iris)), file=stdout())
>
> 
>  class=captiondataframe>
> 
>  
>2.5 %97.5 % 
>
> (Intercept)
> 4.8621
> 5.1499
>
> Speciesversicolor
> 0.7265
> 1.1335
>
> Speciesvirginica
> 1.3785
> 1.7855
>
>  
> 
>  
>  
>
> Cheers,
>
> Josh
>
>
> On Sat, Jan 26, 2013 at 7:36 PM, Erin Hodgess  wrote:
>> Dear R People:
>>
>> I have an AOV model that I get confidence intervals from via
>>
>>> confint(chick1.aov1)
>> 2.5 %   97.5 %
>> trtA 1.472085 1.607915
>> trtB 1.512085 1.647915
>> trtC 1.328751 1.464582
>>>
>>
>> I am using R2HTML to produce HTML output.  However, the HTML code
>> itself just has rounded values, i.e., 1.5 and 1.6.
>>
>> Has anyone run across this, please?
>> Any suggestions would be much appreciated.
>> Sincerely,
>> Erin
>>
>>
>> --
>> Erin Hodgess
>> Associate Professor
>> Department of Computer and Mathematical Sciences
>> University of Houston - Downtown
>> mailto: erinm.hodg...@gmail.com
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> Programmer Analyst II, Statistical Consulting Group
> University of California, Los Angeles
> https://joshuawiley.com/



--
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] decimal places in R2HTML

2013-01-26 Thread Erin Hodgess
Dear R People:

I have an AOV model that I get confidence intervals from via

> confint(chick1.aov1)
2.5 %   97.5 %
trtA 1.472085 1.607915
trtB 1.512085 1.647915
trtC 1.328751 1.464582
>

I am using R2HTML to produce HTML output.  However, the HTML code
itself just has rounded values, i.e., 1.5 and 1.6.

Has anyone run across this, please?
Any suggestions would be much appreciated.
Sincerely,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to remove packages from the active working window

2013-01-26 Thread hp wan
Hi all mailing listers,

My question is as follows:

e.g.
I launched two packages, say packageA and packageB, but they have the
function of the same name, leading to masking. I want to remove the
packageA from the working window after using the packageA so as not to
causing problem. I do not want to carry out task each time using  packageA
and  packageB individually because many the tasks share many parameters.

Any ideals and suggestion will be much appreciated.


Huaping Wan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] different legends in lattice panels

2013-01-26 Thread ilai
On Sat, Jan 26, 2013 at 10:26 AM, Tito de Morais Luis <
luis.tito-de-mor...@ird.fr> wrote:

> Hi listers,
>
> I want to make lattice plots xyplots with the indication of legends
> inside each panel with only the points and the lines actually ploted
> inside each given panel according to the group(ing) factor.
>
> The code below shows what I have achieved so far and I hope will make
> clear what I want to have.
> It seems to me that my solution is a very "dirty hack" and there
> certainly is a much simple and "clean" way to do it.
> Besides, there is no concordance in lty and pch between the legend above
> the graph with those inside the panels.
>
> No. Look again. It is your panel legends that don't correspond to the
actual plot. The plot symbols and line types for the chosen theme !=
pch[1:10] and lty[1:10]. You can either explicitly set the pch and lty in
the plot and auto.key to be 1:10 and proceed with trellis.focus or insert
draw.key in the panel function to automate the procedure and query the
groups and graphical parameters of each panel :

xyplot(lbt ~ de | type, data=dataf, groups =sta,
 type=c("p","g","r"), layout=c(4,1), par.settings = standard.theme(color =
FALSE),
 auto.key=list(space="top", columns=5, lines=TRUE),
 panel=function(x,y,groups,subscripts,...){
  panel.xyplot(x,y,groups=groups,subscripts=subscripts,...)
  pug <- levels(groups)[levels(groups)%in%groups[subscripts]]
  draw.key(key=list(text = list(as.character(pug)),
lines = list(lty =
rep(trellis.par.get('superpose.line')$lty,10)[as.numeric(pug)]),
points = list(pch =
rep(trellis.par.get('superpose.symbol')$pch,10)[as.numeric(pug)])
   ),
   draw=TRUE , vp=viewport(x=0.25,y=0.9))
})

HTH


> I have searched the archive and the web and found some hints that helped
> me a lot to write the code below. But I am not very familiar with
> lattice trellis graphs and I am sure that I am missing something.
> I would appreciate any suggestion that will help me to improve this.
>
> Thank you in advance,
>
> Tito
>
> require(lattice)
> require(grid)
> # some random data
> lbt <- abs(rnorm(100)) # any biological value
> de <- rep(1:10,10) # the depth
> type <- rep(c("A","C","F","S"), c(20,30,40,10)) # the type of sampling zone
> sta <- as.factor(rep(1:10, c(10,10,10,10,10,10,10,10,10,10))) # the
> station number
> dataf <- data.frame(lbt,de,type,sta) # the dataframe
> # key creation
> keyA <- list(border = FALSE, text =
> list(levels(dataf$sta)[1:2]),lines=TRUE,points=TRUE,lty=c(1:2),pch=c(1:2))
> keyC <- list(border = FALSE, text =
> list(levels(dataf$sta)[3:5]),lines=TRUE,points=TRUE,lty=c(3:5),pch=c(3:5))
> keyF <- list(border = FALSE, text =
> list(levels(dataf$sta)[6:9]),lines=TRUE,points=TRUE,lty=c(6:9),pch=c(6:9))
> keyS <- list(border = FALSE, text =
> list(levels(dataf$sta)[10]),lines=TRUE,points=TRUE,lty=c(10),pch=c(10))
>
> # the plot
> xyplot(lbt ~ de | type, data=dataf, groups =
> sta,type=c("p","g","r"),layout=c(4,1),par.settings =
> standard.theme(color = FALSE), auto.key=list(space="top", columns=5,
> lines=TRUE))
>
> # add "legends" inside the panels
> trellis.focus("panel", 1, 1) ; draw.key(keyA, draw = TRUE, vp =
> viewport(.25, .9))
> trellis.focus("panel", 2, 1) ; draw.key(keyC, draw = TRUE, vp =
> viewport(.75, .9))
> trellis.focus("panel", 3, 1) ; draw.key(keyF, draw = TRUE, vp =
> viewport(.75, .9))
> trellis.focus("panel", 4, 1) ; draw.key(keyS, draw = TRUE, vp =
> viewport(.75, .9))
> trellis.unfocus()
>
>
> --
> Luis Tito de Morais
> IRD - UMR LEMAR (IRD/UBO/CNRS/IFREMER)
>
> Tél. : +33 2 98 49 86 35
> Mob. : +33 6 37 67 21 40
>
> Courriel-1 : luis.tito-de-mor...@ird.fr
> Courriel-2 : luis.titodemor...@univ-brest.fr
>
> Pages web :
> Lab. : http://www-iuem.univ-brest.fr/UMR6539/recherche/equipe-5
> Pers. : http://ird.academia.edu/LuisTitodeMorais
> Reshal : http://www.netvibes.com/reshal#Accueil
> Biblio. : http://www.citeulike.org/user/ltitodem
>
>
> [[alternative HTML version deleted]]
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Converting column of strings to boolean

2013-01-26 Thread Pete Brecknock
domcastro wrote
> Hi
> 
> I'm trying to convert a column of strings (nominal types) to a set of
> boolean / binary / logical values. For example, in the column there is
> red, blue, green and yellow. There are 100 rows and each has a colour. I
> want to convert the column to 4 columns: red, blue, green,yellow and then
> either 1 or 0 put in the relevant row.
> Thanks

maybe model.matrix will help 

# d is my understanding of your data
d<-factor(c("red","green","red","blue","green","yellow","red"))
model.matrix(~d -1)

HTH 

Pete



--
View this message in context: 
http://r.789695.n4.nabble.com/Converting-column-of-strings-to-boolean-tp4656739p4656741.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] confidence / prediction ellipse

2013-01-26 Thread Bert Gunter
Well, I'd guess you have to first define what you mean by "prediction
ellipse," as the confidence ellipses are for the bivariate
distribution of 2 parameter estimates -- as I understand it --
whereas predictions depend on the covariate values and are for a
single response value (unless you have fitted multiple responses, I
suppose).

-- Bert

On Sat, Jan 26, 2013 at 1:12 PM, Giuseppe Amatulli
 wrote:
> Hi,
> I'm using the R library(car) to draw confidence/prediction ellipses in a
> scatterplot.
> >From what i understood  the ellipse() function return an ellipse based
> parameters:  shape, center,  radius .
> If i read  dataEllipse() function i can see how these parameters are
> calculated for a confidence ellipse.
>
> ibrary(car)
>
> a=c(12,12,4,5,63,63,23)
> b=c(13,15,7,10,73,83,43)
>
> v <- cov.trob(cbind(a, b))
> shape <- v$cov
> center <- v$center
>
> radius <- sqrt(2 * qf(0.95, 2, length(a) - 1))   # radius <- sqrt(dfn *
> qf(level, dfn, dfd))
>
> conf.elip = ellipse(center, shape, radius,draw = F)
> plot(conf.elip, type='l')
> points(a,b)
>
> My question is how I can calculate shape, center and radius  to obtain a
> prediction ellipses rather than a confidence ellipse?
> Thanks in Advance
> Giuseppe
>
> --
> Giuseppe Amatulli
> Web: www.spatial-ecology.net
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Text mining

2013-01-26 Thread Steve Stephenson
Hi Giovanni,
thanks a lot for your quick reply!!!
I try to answer you in a few points:
1 - A Data Base containing all the towns and the Region they belong to
(North, Sud...) is already available on the ISTAT site (www.ISTAT.it);
2- My goal was just to find a "method" supporting my idea, that is to say
that northern towns names "sound" different from "southern" names;
3- To build this method I should use the ISTAT DB, partially as training set
and partially as validation set;
4- The idea was born just for fun since I find very interesting and also
challenging the data mining;
5- I absolutely agree with you: I will find a lot of exception and therefore
; if the exceptions are greater than the rule (this could happen) this would
imply that my initial idea is wrong. In any case I would be satisfied
because this would mean that I have been able to prove if an in intuition is
right or wrong. 

I hope this can clarify my previous post.
Many thanks and *sorry for the lack of clarity*.

Steve




--
View this message in context: 
http://r.789695.n4.nabble.com/Text-mining-tp4656732p4656738.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread arun
HI,

?grep() found to be a bit faster.


system.time({
indx<-grep(".*\\_.*\\_",wells[,1])
wells2<-wells[-indx,]
wellsNew<-wells[indx,]})
# user  system elapsed 
 # 0.024   0.000   0.023 

 system.time({
 w.sub <- gsub("[^_]+","",wells[,1])
  u.2 <- which(w.sub=="__")
  u.1 <- which(w.sub=="_")
 w.u1<- wells[u.1,]
w.u2<- wells[u.2,]})
#   user  system elapsed 
 # 0.048   0.000   0.047 
 identical(wells2,w.u1)
#[1] TRUE
 identical(wellsNew,w.u2)
#[1] TRUE


A.K.

- Original Message -
From: Berend Hasselman 
To: emorway 
Cc: r-help@r-project.org
Sent: Saturday, January 26, 2013 2:46 PM
Subject: Re: [R] a function more appropriate than 'sapply'?


On 26-01-2013, at 19:43, emorway  wrote:

> I'm wondering if I need to use a function other than sapply as the following
> line of code runs indefinitely (or > 30 min so far) and uses up all 16Gb of
> memory on my machine for what seems like a very small dataset (data attached
> in a txt file  wells.txt
>   ).  The R code is:
> 
> wells<-read.table("c:/temp/wells.txt",col.names=c("name","plc_hldr"))
> wells2<-wells[sapply(wells[,1],function(x)length(strsplit(as.character(x),
> "_")[[1]])==2),]
> 
> The 2nd line of R code above gets bogged down and takes all my RAM with it:
>  
> 
> I'm simply trying to extract all of the lines of data that have a single "_"
> in the first column and place them into a dataset called "wells2".  If that
> were to work, I then want to extract the lines of data that have two "_" and
> put them into a separate dataset, say "wells3".  Is there a better way to do
> this than the one-liner above?


Read your file with

    wells<-read.table("wells.txt",col.names=c("name","plc_hldr"), 
stringsAsFactors=FALSE)

Remove all non underscores with

    w.sub <- gsub("[^_]+","",wells[,1])

then select elements of w.sub with 2 underscores and a single underscore with

    u.2 <- which(w.sub=="__")
    u.1 <- which(w.sub=="_")

and use u.1 and u.2 to select the appropriate rows of wells.

I tried to select rows containing 1 or 2 underscores with grep regular 
expressions but that appeared to be more difficult than I had expected.
The method above is quick.

Berend

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread arun
Hi,
May be this helps:
 wells<-read.table("wells.txt",header=FALSE,stringsAsFactors=F)


 wells2<-wells[-grep(".*\\_.*\\_",wells[,1]),]
  head(wells2)
  #   V1 V2
#1  w7_1  0
#2 w11_1  0
#3 w12_1  0
#4 w13_1  0
#5 w14_1  0
#6 w15_1  0



wellsNew<-wells[grep(".*\\_.*\\_",wells[,1]),]
 head(wellsNew)
#    V1 V2
#851 99_10_4395  0
#852 99_10_4396  0
#853 99_10_4400  0
#854 99_10_4403  0
#855 99_10_4404  0
#856 99_10_4606  0
 nrow(wells)
#[1] 46366
nrow(wells2)
#[1] 38080
 nrow(wellsNew)
#[1] 8286
 38080+8286
#[1] 46366
A.K.



- Original Message -
From: emorway 
To: r-help@r-project.org
Cc: 
Sent: Saturday, January 26, 2013 1:43 PM
Subject: [R] a function more appropriate than 'sapply'?

I'm wondering if I need to use a function other than sapply as the following
line of code runs indefinitely (or > 30 min so far) and uses up all 16Gb of
memory on my machine for what seems like a very small dataset (data attached
in a txt file  wells.txt
  ).  The R code is:

wells<-read.table("c:/temp/wells.txt",col.names=c("name","plc_hldr"))
wells2<-wells[sapply(wells[,1],function(x)length(strsplit(as.character(x),
"_")[[1]])==2),]

The 2nd line of R code above gets bogged down and takes all my RAM with it:
 

I'm simply trying to extract all of the lines of data that have a single "_"
in the first column and place them into a dataset called "wells2".  If that
were to work, I then want to extract the lines of data that have two "_" and
put them into a separate dataset, say "wells3".  Is there a better way to do
this than the one-liner above?

-Eric



--
View this message in context: 
http://r.789695.n4.nabble.com/a-function-more-appropriate-than-sapply-tp4656723.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loading data into R

2013-01-26 Thread arun
Hi,
myData[]<-lapply(myData,as.character)
 as.matrix(myData)
# V1  V2   V3  V4  V5 
#[1,] "a" "b"  "c" "d" "f"
#[2,] "2" "4"  ""  ""  "7"
#[3,] ""  ""   ""  ""  "" 
#[4,] ""  "34" ""  "4" "" 
#[5,] "2" ""   "4" ""  "4"


str(as.matrix(myData))
# chr [1:5, 1:5] "a" "2" "" "" "2" "b" "4" "" "34" "" ...
 #- attr(*, "dimnames")=List of 2
  #..$ : NULL
  #..$ : chr [1:5] "V1" "V2" "V3" "V4" ...
A.K.



- Original Message -
From: Christofer Bogaso 
To: r-help 
Cc: 
Sent: Saturday, January 26, 2013 3:00 PM
Subject: [R] Loading data into R

Hello again,

I generally use Clipboard to load data into R from Excel using the
read.delim() function. In most cases, my data after loading looks like
below:

myData <- structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c("",
"2", "a"), class = "factor"), V2 = structure(c(4L, 3L, 1L, 2L,
1L), .Label = c("", "34", "4", "b"), class = "factor"), V3 = structure(c(3L,
1L, 1L, 1L, 2L), .Label = c("", "4", "c"), class = "factor"),
    V4 = structure(c(3L, 1L, 1L, 2L, 1L), .Label = c("", "4",
    "d"), class = "factor"), V5 = structure(c(4L, 3L, 1L, 1L,
    2L), .Label = c("", "4", "7", "f"), class = "factor")), .Names = c("V1",
"V2", "V3", "V4", "V5"), class = "data.frame", row.names = c(NA,
-5L))


> myData
  V1 V2 V3 V4 V5
1  a  b  c  d  f
2  2  4        7
3
4    34     4
5  2     4     4


Now I want to put this data in a Matrix class with all elements are
character. So tried this :

> as.character(myData)
[1] "c(3, 2, 1, 1, 2)" "c(4, 3, 1, 2, 1)" "c(3, 1, 1, 1, 2)" "c(3, 1,
1, 2, 1)" "c(4, 3, 1, 1, 2)"


This looks funny and does not conform the original data. Can somebody
point me what would be right way to put it into Matrix?

Thanks and regards,

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Text mining

2013-01-26 Thread Giovanni Azua
Hi Steve,

IMO this problem does not need a classifier but rather a database and a
simple query. I would just build a database with all city names including
the geo information, and then say whether it is north or south exactly. 

If there was such a "rule" (which I doubt) I would expect it to have many
exceptions and therefore a bunch of false-positives on both sides. Why
overcomplicate a simple problem? 

HTH,
Ciao,
Giovanni

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Steve Stephenson
Sent: Saturday, January 26, 2013 10:08 PM
To: r-help@r-project.org
Subject: [R] Text mining

Hallo to everybody,
I would like to perform an analysis but I don't know how to proceed and
whether R packages are available for my purpose or not. Therefore I'm here
to request your support.
*The idea is the following:* I noticed that the names of the towns and
villages in northern Italy most of the time sound differently from names of
cities based on southern Italy. Just to give you an idea "Caronno
Pertusella" is a northern Italy village while Frascati is a center Italy
town. Most of the time I am able to recognize where the town is located just
hearing the name but I cannot say why, that is to say that I didn't find a
"rule".
What I would like to do is to find a classification rule/engine that is able
to "locate" the city starting from its name. *I think the classification
method should be based on the sequence of letters belonging to the town's
name*. But this is just an intuition not yet formalized!
I know that mine is a strange request and idea, anyway advices are very
appreciated and welcome!
Many thanks in advance to all.

Steve



--
View this message in context:
http://r.789695.n4.nabble.com/Text-mining-tp4656732.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Text mining

2013-01-26 Thread Steve Stephenson
Hallo to everybody,
I would like to perform an analysis but I don't know how to proceed and
whether R packages are available for my purpose or not. Therefore I'm here
to request your support.
*The idea is the following:* I noticed that the names of the towns and
villages in northern Italy most of the time sound differently from names of
cities based on southern Italy. Just to give you an idea "Caronno
Pertusella" is a northern Italy village while Frascati is a center Italy
town. Most of the time I am able to recognize where the town is located just
hearing the name but I cannot say why, that is to say that I didn't find a
"rule".
What I would like to do is to find a classification rule/engine that is able
to "locate" the city starting from its name. *I think the classification
method should be based on the sequence of letters belonging to the town's
name*. But this is just an intuition not yet formalized!
I know that mine is a strange request and idea, anyway advices are very
appreciated and welcome!
Many thanks in advance to all.

Steve



--
View this message in context: 
http://r.789695.n4.nabble.com/Text-mining-tp4656732.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread Uwe Ligges



On 26.01.2013 21:23, Berend Hasselman wrote:


On 26-01-2013, at 21:09, Uwe Ligges  wrote:




On 26.01.2013 20:46, Berend Hasselman wrote:


On 26-01-2013, at 19:43, emorway  wrote:


I'm wondering if I need to use a function other than sapply as the following
line of code runs indefinitely (or > 30 min so far) and uses up all 16Gb of
memory on my machine for what seems like a very small dataset (data attached
in a txt file  wells.txt
  ).  The R code is:

wells<-read.table("c:/temp/wells.txt",col.names=c("name","plc_hldr"))
wells2<-wells[sapply(wells[,1],function(x)length(strsplit(as.character(x),
"_")[[1]])==2),]

The 2nd line of R code above gets bogged down and takes all my RAM with it:


I'm simply trying to extract all of the lines of data that have a single "_"
in the first column and place them into a dataset called "wells2".  If that
were to work, I then want to extract the lines of data that have two "_" and
put them into a separate dataset, say "wells3".  Is there a better way to do
this than the one-liner above?



Read your file with

wells<-read.table("wells.txt",col.names=c("name","plc_hldr"), 
stringsAsFactors=FALSE)

Remove all non underscores with

w.sub <- gsub("[^_]+","",wells[,1])

then select elements of w.sub with 2 underscores and a single underscore with

u.2 <- which(w.sub=="__")
u.1 <- which(w.sub=="_")

and use u.1 and u.2 to select the appropriate rows of wells.


With grep:

wells1 <- wells[grep("^[^\\_]*_[^\\_]*$", wells[,1]),]
wells2 <- wells[grep("^[^\\_]*_[^\\_]*_[^\\_]*$", wells[,1]),]



Are the \\ necessary?
I tried without the \\ and that gives identical results.


Ah, I was not sure and then I forgot to look into the docs. Let's pass 
it as an exercise to the reader.


Best,
Uwe





Berend



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loading data into R

2013-01-26 Thread Duncan Murdoch

On 13-01-26 3:00 PM, Christofer Bogaso wrote:

Hello again,

I generally use Clipboard to load data into R from Excel using the
read.delim() function. In most cases, my data after loading looks like
below:

myData <- structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c("",
"2", "a"), class = "factor"), V2 = structure(c(4L, 3L, 1L, 2L,
1L), .Label = c("", "34", "4", "b"), class = "factor"), V3 = structure(c(3L,
1L, 1L, 1L, 2L), .Label = c("", "4", "c"), class = "factor"),
 V4 = structure(c(3L, 1L, 1L, 2L, 1L), .Label = c("", "4",
 "d"), class = "factor"), V5 = structure(c(4L, 3L, 1L, 1L,
 2L), .Label = c("", "4", "7", "f"), class = "factor")), .Names = c("V1",
"V2", "V3", "V4", "V5"), class = "data.frame", row.names = c(NA,
-5L))



myData

   V1 V2 V3 V4 V5
1  a  b  c  d  f
2  2  47
3
434 4
5  2 4 4


Now I want to put this data in a Matrix class with all elements are
character. So tried this :


as.character(myData)

[1] "c(3, 2, 1, 1, 2)" "c(4, 3, 1, 2, 1)" "c(3, 1, 1, 1, 2)" "c(3, 1,
1, 2, 1)" "c(4, 3, 1, 1, 2)"


This looks funny and does not conform the original data. Can somebody
point me what would be right way to put it into Matrix?


Use as.matrix(myData).

Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread Berend Hasselman

On 26-01-2013, at 21:09, Uwe Ligges  wrote:

> 
> 
> On 26.01.2013 20:46, Berend Hasselman wrote:
>> 
>> On 26-01-2013, at 19:43, emorway  wrote:
>> 
>>> I'm wondering if I need to use a function other than sapply as the following
>>> line of code runs indefinitely (or > 30 min so far) and uses up all 16Gb of
>>> memory on my machine for what seems like a very small dataset (data attached
>>> in a txt file  wells.txt
>>>   ).  The R code is:
>>> 
>>> wells<-read.table("c:/temp/wells.txt",col.names=c("name","plc_hldr"))
>>> wells2<-wells[sapply(wells[,1],function(x)length(strsplit(as.character(x),
>>> "_")[[1]])==2),]
>>> 
>>> The 2nd line of R code above gets bogged down and takes all my RAM with it:
>>> 
>>> 
>>> I'm simply trying to extract all of the lines of data that have a single "_"
>>> in the first column and place them into a dataset called "wells2".  If that
>>> were to work, I then want to extract the lines of data that have two "_" and
>>> put them into a separate dataset, say "wells3".  Is there a better way to do
>>> this than the one-liner above?
>> 
>> 
>> Read your file with
>> 
>>  wells<-read.table("wells.txt",col.names=c("name","plc_hldr"), 
>> stringsAsFactors=FALSE)
>> 
>> Remove all non underscores with
>> 
>>  w.sub <- gsub("[^_]+","",wells[,1])
>> 
>> then select elements of w.sub with 2 underscores and a single underscore with
>> 
>>  u.2 <- which(w.sub=="__")
>>  u.1 <- which(w.sub=="_")
>> 
>> and use u.1 and u.2 to select the appropriate rows of wells.
> 
> With grep:
> 
> wells1 <- wells[grep("^[^\\_]*_[^\\_]*$", wells[,1]),]
> wells2 <- wells[grep("^[^\\_]*_[^\\_]*_[^\\_]*$", wells[,1]),]
> 

Are the \\ necessary?
I tried without the \\ and that gives identical results.

Berend

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread Uwe Ligges



On 26.01.2013 20:46, Berend Hasselman wrote:


On 26-01-2013, at 19:43, emorway  wrote:


I'm wondering if I need to use a function other than sapply as the following
line of code runs indefinitely (or > 30 min so far) and uses up all 16Gb of
memory on my machine for what seems like a very small dataset (data attached
in a txt file  wells.txt
  ).  The R code is:

wells<-read.table("c:/temp/wells.txt",col.names=c("name","plc_hldr"))
wells2<-wells[sapply(wells[,1],function(x)length(strsplit(as.character(x),
"_")[[1]])==2),]

The 2nd line of R code above gets bogged down and takes all my RAM with it:


I'm simply trying to extract all of the lines of data that have a single "_"
in the first column and place them into a dataset called "wells2".  If that
were to work, I then want to extract the lines of data that have two "_" and
put them into a separate dataset, say "wells3".  Is there a better way to do
this than the one-liner above?



Read your file with

wells<-read.table("wells.txt",col.names=c("name","plc_hldr"), 
stringsAsFactors=FALSE)

Remove all non underscores with

w.sub <- gsub("[^_]+","",wells[,1])

then select elements of w.sub with 2 underscores and a single underscore with

u.2 <- which(w.sub=="__")
u.1 <- which(w.sub=="_")

and use u.1 and u.2 to select the appropriate rows of wells.


With grep:

wells1 <- wells[grep("^[^\\_]*_[^\\_]*$", wells[,1]),]
wells2 <- wells[grep("^[^\\_]*_[^\\_]*_[^\\_]*$", wells[,1]),]


Best,
Uwe Ligges



I tried to select rows containing 1 or 2 underscores with grep regular 
expressions but that appeared to be more difficult than I had expected.
The method above is quick.

Berend

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Loading data into R

2013-01-26 Thread Christofer Bogaso
Hello again,

I generally use Clipboard to load data into R from Excel using the
read.delim() function. In most cases, my data after loading looks like
below:

myData <- structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c("",
"2", "a"), class = "factor"), V2 = structure(c(4L, 3L, 1L, 2L,
1L), .Label = c("", "34", "4", "b"), class = "factor"), V3 = structure(c(3L,
1L, 1L, 1L, 2L), .Label = c("", "4", "c"), class = "factor"),
V4 = structure(c(3L, 1L, 1L, 2L, 1L), .Label = c("", "4",
"d"), class = "factor"), V5 = structure(c(4L, 3L, 1L, 1L,
2L), .Label = c("", "4", "7", "f"), class = "factor")), .Names = c("V1",
"V2", "V3", "V4", "V5"), class = "data.frame", row.names = c(NA,
-5L))


> myData
  V1 V2 V3 V4 V5
1  a  b  c  d  f
2  2  47
3
434 4
5  2 4 4


Now I want to put this data in a Matrix class with all elements are
character. So tried this :

> as.character(myData)
[1] "c(3, 2, 1, 1, 2)" "c(4, 3, 1, 2, 1)" "c(3, 1, 1, 1, 2)" "c(3, 1,
1, 2, 1)" "c(4, 3, 1, 1, 2)"


This looks funny and does not conform the original data. Can somebody
point me what would be right way to put it into Matrix?

Thanks and regards,

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread Berend Hasselman

On 26-01-2013, at 19:43, emorway  wrote:

> I'm wondering if I need to use a function other than sapply as the following
> line of code runs indefinitely (or > 30 min so far) and uses up all 16Gb of
> memory on my machine for what seems like a very small dataset (data attached
> in a txt file  wells.txt
>   ).  The R code is:
> 
> wells<-read.table("c:/temp/wells.txt",col.names=c("name","plc_hldr"))
> wells2<-wells[sapply(wells[,1],function(x)length(strsplit(as.character(x),
> "_")[[1]])==2),]
> 
> The 2nd line of R code above gets bogged down and takes all my RAM with it:
>  
> 
> I'm simply trying to extract all of the lines of data that have a single "_"
> in the first column and place them into a dataset called "wells2".  If that
> were to work, I then want to extract the lines of data that have two "_" and
> put them into a separate dataset, say "wells3".  Is there a better way to do
> this than the one-liner above?


Read your file with

wells<-read.table("wells.txt",col.names=c("name","plc_hldr"), 
stringsAsFactors=FALSE)

Remove all non underscores with

w.sub <- gsub("[^_]+","",wells[,1])

then select elements of w.sub with 2 underscores and a single underscore with

u.2 <- which(w.sub=="__")
u.1 <- which(w.sub=="_")

and use u.1 and u.2 to select the appropriate rows of wells.

I tried to select rows containing 1 or 2 underscores with grep regular 
expressions but that appeared to be more difficult than I had expected.
The method above is quick.

Berend

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] a function more appropriate than 'sapply'?

2013-01-26 Thread emorway
I'm wondering if I need to use a function other than sapply as the following
line of code runs indefinitely (or > 30 min so far) and uses up all 16Gb of
memory on my machine for what seems like a very small dataset (data attached
in a txt file  wells.txt
  ).  The R code is:

wells<-read.table("c:/temp/wells.txt",col.names=c("name","plc_hldr"))
wells2<-wells[sapply(wells[,1],function(x)length(strsplit(as.character(x),
"_")[[1]])==2),]

The 2nd line of R code above gets bogged down and takes all my RAM with it:
 

I'm simply trying to extract all of the lines of data that have a single "_"
in the first column and place them into a dataset called "wells2".  If that
were to work, I then want to extract the lines of data that have two "_" and
put them into a separate dataset, say "wells3".  Is there a better way to do
this than the one-liner above?

-Eric



--
View this message in context: 
http://r.789695.n4.nabble.com/a-function-more-appropriate-than-sapply-tp4656723.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] stepwise variable selection method wanted

2013-01-26 Thread Uwe Ligges



On 19.01.2013 01:57, Julien Mehl Vettori wrote:

Dear Herry,


This is the R-help mailing list with thousands of readers. Your message 
is without any context. Do you really expect an answer?


Best,
Uwe Ligges



I would like to know if you found an answer elsewhere to your question.
I'm trying to get information around the nodes of a CA (daisy() followed
by agnes()) made on plant trait using the gower metric for taxonomic
purpuse. I'm not an expert in statistic but I understood that your way
might be the only way to get the meaning of the structure of a such CA,
even if quite slow.
I already started to implement your function to use the weight and type
(logr, asymm, symm and ordr) dynamically. But maybe some easier and less
CPU cost way does exist now... somewhere...
I'm having bad time with R but you might help.

  Thanks for you answer.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error with Expected Shortfall function, ES.

2013-01-26 Thread Uwe Ligges



On 24.01.2013 13:33, kevj1980 wrote:

ES function gives the below error.


ES(sim, p=.95, method=c("modified"),portfolio_method=c("component"),
weights=w1)



We get:
Error: object 'ES' not found


Uwe Ligges



/Error in checkData(R, method = "xts", ...) : The data cannot be converted
into a time series.  If you are trying to pass in names from a data object
with one column, you should use the form 'data[rows, columns, drop =
FALSE]'.  Rownames should have standard date formats, such as '1985-03-15'.
/

The problem, I believe, is when the function comes to building a time-series
of portfolio returns when multiplying matrix 'sim' with vector 'w1'.  I
think vector 'w1' may be posing the problem, but I do not know why.

***
Notes:
sim is a 1000*4 matrix

w1 is 4*1 column vector
**

As always, any pointers or expertise will be forever great-fully received!!!

kevj



--
View this message in context: 
http://r.789695.n4.nabble.com/Error-with-Expected-Shortfall-function-ES-tp4656500.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loop question?

2013-01-26 Thread Jeff Newmiller
The unlist-sapply-seq_len bit is unnecessarily convoluted, since the 
infcprodessa function can accept vector inputs.

z <- infcprodessa( ab$a, TINF, ab$b, ab$b-TINF )
possibles <- ab[ z >= 15 & z <= 20, ]
possibles[ which.min( possibles$a ), ]
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Berend Hasselman  wrote:

>
>On 26-01-2013, at 12:31, Andras Farkas  wrote:
>
>> 
>> Sorry Jeff, probably the new version of Yahoo mail doing the html, I
>switched back to the older one hope that takes care of the problem. Let
>me clarify the code below:
>> 
>> TINF <-1
>> a <-c(500,750,1000,1250,1500,1750,2000)
>> b <-c(8,12,18,24,36,48,60,72,96)
>> 
>> infcprodessa <-function (D, tin, tau, ts) 
>> (D * (1 - exp(-0.048 * tin))/(tin * (0.048*79) * (1 - exp(-0.048
>* tau * exp(-0.048 * (ts - tin))
>> 
>> z <-sapply(1:1, function(n) infcprodessa(a,TINF,b,b-TINF)) 
>> 
>> so I am looking to find the combination of a = 1000 and b = 12, which
>iz a value for "z" that would fall between 15 and 20. Sometimes though
>there may be more than one combinations that will meet criteria, in
>that case I would like to select the combination based on the smallest
>"a" value that has the respective "b" value to meet the criteria,
>> 
>
>ab <- expand.grid(a=a,b=b)
>z <- unlist(sapply(seq_len(nrow(ab)), function(k)
>infcprodessa(ab[k,1],TINF,ab[k,2],ab[k,2]-TINF)))
>
>z.target <- which(z>=15 & z<=20)
>ab[z.target,]
>z[z.target]
>which.min(ab[z.target,][,"a"])
>
>Berend
>
>__
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] different legends in lattice panels

2013-01-26 Thread Tito de Morais Luis
Hi listers,

I want to make lattice plots xyplots with the indication of legends 
inside each panel with only the points and the lines actually ploted 
inside each given panel according to the group(ing) factor.

The code below shows what I have achieved so far and I hope will make 
clear what I want to have.
It seems to me that my solution is a very "dirty hack" and there 
certainly is a much simple and "clean" way to do it.
Besides, there is no concordance in lty and pch between the legend above 
the graph with those inside the panels.

I have searched the archive and the web and found some hints that helped 
me a lot to write the code below. But I am not very familiar with 
lattice trellis graphs and I am sure that I am missing something.
I would appreciate any suggestion that will help me to improve this.

Thank you in advance,

Tito

require(lattice)
require(grid)
# some random data
lbt <- abs(rnorm(100)) # any biological value
de <- rep(1:10,10) # the depth
type <- rep(c("A","C","F","S"), c(20,30,40,10)) # the type of sampling zone
sta <- as.factor(rep(1:10, c(10,10,10,10,10,10,10,10,10,10))) # the 
station number
dataf <- data.frame(lbt,de,type,sta) # the dataframe
# key creation
keyA <- list(border = FALSE, text = 
list(levels(dataf$sta)[1:2]),lines=TRUE,points=TRUE,lty=c(1:2),pch=c(1:2))
keyC <- list(border = FALSE, text = 
list(levels(dataf$sta)[3:5]),lines=TRUE,points=TRUE,lty=c(3:5),pch=c(3:5))
keyF <- list(border = FALSE, text = 
list(levels(dataf$sta)[6:9]),lines=TRUE,points=TRUE,lty=c(6:9),pch=c(6:9))
keyS <- list(border = FALSE, text = 
list(levels(dataf$sta)[10]),lines=TRUE,points=TRUE,lty=c(10),pch=c(10))

# the plot
xyplot(lbt ~ de | type, data=dataf, groups = 
sta,type=c("p","g","r"),layout=c(4,1),par.settings = 
standard.theme(color = FALSE), auto.key=list(space="top", columns=5, 
lines=TRUE))

# add "legends" inside the panels
trellis.focus("panel", 1, 1) ; draw.key(keyA, draw = TRUE, vp = 
viewport(.25, .9))
trellis.focus("panel", 2, 1) ; draw.key(keyC, draw = TRUE, vp = 
viewport(.75, .9))
trellis.focus("panel", 3, 1) ; draw.key(keyF, draw = TRUE, vp = 
viewport(.75, .9))
trellis.focus("panel", 4, 1) ; draw.key(keyS, draw = TRUE, vp = 
viewport(.75, .9))
trellis.unfocus()


-- 
Luis Tito de Morais
IRD - UMR LEMAR (IRD/UBO/CNRS/IFREMER)

Tél. : +33 2 98 49 86 35
Mob. : +33 6 37 67 21 40

Courriel-1 : luis.tito-de-mor...@ird.fr
Courriel-2 : luis.titodemor...@univ-brest.fr

Pages web :
Lab. : http://www-iuem.univ-brest.fr/UMR6539/recherche/equipe-5
Pers. : http://ird.academia.edu/LuisTitodeMorais
Reshal : http://www.netvibes.com/reshal#Accueil
Biblio. : http://www.citeulike.org/user/ltitodem


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cannot allocate memory block of size 2.7 Gb

2013-01-26 Thread Uwe Ligges



On 23.01.2013 23:41, Cláudio Brisolara wrote:





Hello R-users

I am getting error messagens when I require some packages or execute some 
procedures, like these below:


require(tseries)

Loading required package: tseries
Error in get(Info[i, 1], envir = env) :
   cannot allocate memory block of size 2.7 Gb

require (TSA)

Loading required package: TSA
Loading required package: locfit
Error in get(Info[i, 1], envir = env) :
   cannot allocate memory block of size 2.7 Gb
Failed with error:  ‘package ‘locfit’ could not be loaded’

I used the commands memory.limit() and memory.size() to check memory 
limitation, but I could not see any problem. I send also sessionInfo() data. I 
have run the same script and different computers with less memory capacity, so 
it seems to me that it is not a real memory problem.


memory.limit()

[1] 6004


Apparently you need  ore than that.
But we do not know how much your workspace is messed up  or what you did 
that at least 2.7 Gb additional memory is required in your next step.


Best,
Uwe Ligges






memory.size()

[1] 1361.88


sessionInfo()

R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.1252

loaded via a namespace (and not attached):
[1] grid_2.15.2  quadprog_1.5-4   stabledist_0.6-5 tools_2.15.2
[5] xtable_1.7-0


Please, someone can help me understand that is happening and what should I do 
to fix it?

Regards,

Cláudio Brisolara
Postgraduate student
University of São Paulo

[[alternative HTML version deleted]]



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.csv quotes within fields

2013-01-26 Thread peter dalgaard

On Jan 26, 2013, at 16:32 , Tim Howard wrote:

> Duncan, 
> Good point - I guess I am expecting too much. I'll work on a global replace 
> before import or chopping with strsplit while importing. 
> 
> FYI everyone - these folks with the non-standard csv are the US Feds:
> https://oeaaa.faa.gov/oeaaa/external/public/publicAction.jsp?action=showCaseDownloadForm
> 
> (see off-airport AEA 2005 for a csv with issues.)

Does this do the trick?

dd <- read.csv(text=gsub("\\\"", "\"\"", fixed=TRUE,
   readLines("~/Downloads/OffAirportAEA2005List.csv")))



> 
> Thank you for the help. I really do appreciate the suggested solutions.
> Also, thanks to John Kane for the link to csvEdit. 
> 
> Tim
> 
 Duncan Murdoch  01/25/13 6:37 PM >>>
> On 13-01-25 4:37 PM, Tim Howard wrote:
>> David,
>> Thank you again for the reply. I'll try to make readLines() and strplit() 
>> work.  What bugs me is that I think it would import fine if the folks who 
>> created the csv had used double quotes "" rather than an escaped quote \" 
>> for those pesky internal quotes. Since that's the case, I'd think there 
>> would be a solution within read.csv() ... or perhaps scan()?, I just can't 
>> figure it out.
> 
> What you say doesn't make sense.  Let me paraphrase:
> 
> "The folks who sent me the data created a weird, non-standard .csv file. 
>  You'd think read.csv() could handle it."
> 
> The standard way to handle quotes in strings is to double them.  They 
> didn't, so you've got a weird file on your hands.
> 
> You can probably fix it by doing a global substitution of all "backslash 
> doublequote" pairs with "doublequote doublequote".  Unless they have 
> some "backslash backslash doublequote" triples that they want you to 
> interpret as "backslash doublequote".  Or some other weirdness.
> 
> I'd suggest you try the global subst mentioned above. or ask them for 
> data in a reasonably standardized format.
> 
> Duncan Murdoch
> 
>> best,
>> Tim
>> 
> David Winsemius  1/25/2013 4:16 PM >>>
>> 
>> On Jan 25, 2013, at 11:35 AM, Tim Howard wrote:
>> 
>>> Great point, your fix (quote="") works for the example I gave. 
>>> Unfortunately, these text strings have commas in them as well(!).  Throw a 
>>> few commas in any of the text strings and it breaks again.  Sorry about not 
>>> including those in the example.
>>> 
>>> So, I need to incorporate commas *and* quotes with the escape character 
>>> within a single string.
>> 
>> Well you need to have _some_ delimiter. At the moment it sounds as though 
>> you might end upusing readLines() and strsplit( . , split="\\'\\,\\s\\").
>> 
>> 
>> 
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
> 
> 
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Removal of columns from matrix where all values of the column are identical.

2013-01-26 Thread arun
HI Ben,

Sorry, I didn't test it at that time to different cases.
testm[,apply(testm,2,function(x) all(c(TRUE,x[-length(x)]!=x[-1])))]
x[-length(x)] #removes the last observation in each column
x[-1] #removes the first observation in each column
#and compares them for each column.

If I change the code a bit, it should work:
testm[,apply(testm,2,function(x) any(c(FALSE,x[-length(x)]!=x[-1])))]
 #    [,1] [,2] [,3] [,4]
#[1,]    1    3    5    1
#[2,]    2    3    4    2
#[3,]    3    3    3    3
#[4,]    4    4    2    4
#[5,]    5    3    1    4

#Changing your dataset:


testm1<-matrix(nrow=5, ncol=5)
testm1[,1] <- c(1,2,3,4,5)
testm1[,2] <- c(3,3,3,3,3)
testm1[,3] <- c(3,3,4,4,3)
testm1[,4] <- c(5,4,3,2,1)
testm1[,5] <- c(2,2,3,4,4)
testm1[,apply(testm1,2,function(x) any(c(FALSE,x[-length(x)]!=x[-1])))]
# [,1] [,2] [,3] [,4]
#[1,]    1    3    5    2
#[2,]    2    3    4    2
#[3,]    3    4    3    3
#[4,]    4    4    2    4
#[5,]    5    3    1    4
set.seed(15)
testm2<-matrix(c(sample(letters[1:5],20,replace=TRUE),rep("a",5)),ncol=5)
testm2[,apply(testm2,2,function(x) any(c(FALSE,x[-length(x)]!=x[-1])))]
 #    [,1] [,2] [,3] [,4]
#[1,] "d"  "e"  "a"  "e" 
#[2,] "a"  "e"  "d"  "c" 
#[3,] "e"  "b"  "c"  "e" 
#[4,] "d"  "d"  "d"  "a" 
#[5,] "b"  "e"  "e"  "d" 


A.K.



- Original Message -
From: Benjamin Ward (ENV) 
To: arun 
Cc: R help 
Sent: Saturday, January 26, 2013 8:37 AM
Subject: RE: [R] Removal of columns from matrix where all values of the column 
are identical.

Hi,

I've been trying to work this out how it works, I'm still not totally sure but 
seems to me it subsets the matrix according to whether each column returns all 
TRUE, to not being the same values when you compare the column[-1] and the 
column[-length(column)], essentially siding the column against itself and 
making comparison? It seems that it also removed columns with any repeated 
values, rather than columns in which all values are the same:

testm<-matrix(nrow=5, ncol=5)
testm[,1] <- c(1,2,3,4,5)
testm[,2] <- c(3,3,3,3,3)
testm[,3] <- c(3,3,4,4,3)
testm[,4] <- c(5,4,3,2,1)
testm[,5] <- c(2,2,3,4,4)
testm

test3 <- testm[,apply(testm,2,function(x) all(c(TRUE,x[-length(x)]!=x[-1])))]
test3

test3
     [,1] [,2]
[1,]    1    5
[2,]    2    4
[3,]    3    3
[4,]    4    2
[5,]    5    1

Thanks,
Ben W.


From: arun [smartpink...@yahoo.com]
Sent: 26 January 2013 02:34
To: Benjamin Ward (ENV)
Cc: R help
Subject: Re: [R] Removal of columns from matrix where all values of the column 
are identical.

Hi,

I guess this should also work:


Matrix[,apply(Matrix,2,function(x) all(c(TRUE,x[-length(x)]!=x[-1])))]
#     [,1] [,2] [,3]
#[1,]    1    5    5
#[2,]    2    4    1
#[3,]    3    3    4
#[4,]    4    2    3
#[5,]    5    1    2
A.K.



- Original Message -
From: Benjamin Ward (ENV) 
To: "r-help@r-project.org" 
Cc:
Sent: Friday, January 25, 2013 6:17 PM
Subject: [R] Removal of columns from matrix where all values of the column are 
identical.

Hi all,

I'd like to write a piece of code which will remove columns from a matrix, if 
the column contains only one value, say every value in the column is a "3":

Matrix <- matrix(NA, nrow=5, ncol=4)
Matrix[,1] <- c(1,2,3,4,5)
Matrix[,2] <- c(3,3,3,3,3)
Matrix[,3] <- c(5,4,3,2,1)
Matrix[,4] <- c(5,1,4,3,2)

      [,1] [,2] [,3] [,4]
[1,]    1    3    5    5
[2,]    2    3    4    1
[3,]    3    3    3    4
[4,]    4    3    2    3
[5,]    5    3    1    2

What I have written so far is a loop which will see if all values are the same, 
a bit of a hack since it just checks all values are equal to the first value of 
the column, if not, by definition the column cannot contain only one 
value/variable/character:

removals<-c()
for(i in 1:ncol(Matrix)){
  if(all(Matrix[,i] == Matrix[[1,i]])){
    removals<-append(removals, i)
  }
}
new.Matrix <- Matrix[,-removals]

This works for matrices with numbers or characters.
My question is - is there a better or more efficient way of doing this, maybe 
with apply or something. My first thought was apply set to operate over all 
columns, but was unsure of the indexing and selecting columns to be deleted.

Thanks,

Ben W.

University of East Anglia (ENV): b.w...@uea.ac.uk
The Sainsbury Laboratory: ben.w...@sainsbury-laboratory.ac.uk

    [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loop question?

2013-01-26 Thread Berend Hasselman

On 26-01-2013, at 12:31, Andras Farkas  wrote:

> 
> Sorry Jeff, probably the new version of Yahoo mail doing the html, I switched 
> back to the older one hope that takes care of the problem. Let me clarify the 
> code below:
> 
> TINF <-1
> a <-c(500,750,1000,1250,1500,1750,2000)
> b <-c(8,12,18,24,36,48,60,72,96)
> 
> infcprodessa <-function (D, tin, tau, ts) 
> (D * (1 - exp(-0.048 * tin))/(tin * (0.048*79) * (1 - exp(-0.048 * 
> tau * exp(-0.048 * (ts - tin))
> 
> z <-sapply(1:1, function(n) infcprodessa(a,TINF,b,b-TINF)) 
> 
> so I am looking to find the combination of a = 1000 and b = 12, which iz a 
> value for "z" that would fall between 15 and 20. Sometimes though there may 
> be more than one combinations that will meet criteria, in that case I would 
> like to select the combination based on the smallest "a" value that has the 
> respective "b" value to meet the criteria,
> 

ab <- expand.grid(a=a,b=b)
z <- unlist(sapply(seq_len(nrow(ab)), function(k) 
infcprodessa(ab[k,1],TINF,ab[k,2],ab[k,2]-TINF)))

z.target <- which(z>=15 & z<=20)
ab[z.target,]
z[z.target]
which.min(ab[z.target,][,"a"])

Berend

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Attempting to confirm a program i wrote in C (normalize 2 datasets, transform into histogram, transform into CDF, perform KS test)

2013-01-26 Thread Jeff Newmiller
It is generally expected that the questioner pose a specific example so the 
respondent can have some assurance they are answering the actual question. In 
this case please provide a test data set, intermediate results, and final 
result generated by your C program. It would also show that you made a 
reasonable effort if you showed what steps you tried in R and where you think 
they went wrong.

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Tarskin  wrote:

>I have written a program in C that two xy datasets, aligns these 2
>datasets
>based on shared features, transforms them into equal sized histograms,
>transforms the histograms into cumulative distribution functions (via
>GSL)
>and finally performs a KS_test.
>
>I am wanting to validate my program's results and figure'd i would use
>R but
>i am kinda stuck at ithe histograms (I have 2 histogram objects with
>the
>same #bins, weighted by the Y value) right now and not really sure how
>to
>transform these into CDF to perform a KS.test, I looked at the edf
>function
>but got kind of lost.
>
>I realize this is most likely a very basic question but I am just not
>that
>familiar with R :(
>
>Thanks in advanc
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Attempting-to-confirm-a-program-i-wrote-in-C-normalize-2-datasets-transform-into-histogram-transform-tp4656704.html
>Sent from the R help mailing list archive at Nabble.com.
>
>__
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Setting global variables inside R reference class ?

2013-01-26 Thread Jeff Newmiller
How can we possibly know where you went wrong if you don't tell us where you 
went?

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Praveen K  wrote:

>Hello,
>
>I'm a newbie to R, I have a quesiton.
>
>I'm a bit confused on global variable assignments.
>
>I have the following situation. I have 2 global variables current_idx
>and
>previous_idx. *These 2 global variables have to be set by a method in a
>reference class*.
>
>Essentially, using <<- assignment operator should work right ? But, I
>get
>this warning
>
>Non-local assignment to non-field names (possibly misspelled?)
>
>Where am I going wrong ?
>
>Will assign(current_idx, index, envir = .GlobalEnv) work ?
>
>
>Thanks !
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.csv quotes within fields

2013-01-26 Thread Tim Howard
Duncan, 
Good point - I guess I am expecting too much. I'll work on a global replace 
before import or chopping with strsplit while importing. 

FYI everyone - these folks with the non-standard csv are the US Feds:
https://oeaaa.faa.gov/oeaaa/external/public/publicAction.jsp?action=showCaseDownloadForm

(see off-airport AEA 2005 for a csv with issues.)

Thank you for the help. I really do appreciate the suggested solutions.
Also, thanks to John Kane for the link to csvEdit. 

Tim

>>> Duncan Murdoch  01/25/13 6:37 PM >>>
On 13-01-25 4:37 PM, Tim Howard wrote:
> David,
> Thank you again for the reply. I'll try to make readLines() and strplit() 
> work.  What bugs me is that I think it would import fine if the folks who 
> created the csv had used double quotes "" rather than an escaped quote \" for 
> those pesky internal quotes. Since that's the case, I'd think there would be 
> a solution within read.csv() ... or perhaps scan()?, I just can't figure it 
> out.

What you say doesn't make sense.  Let me paraphrase:

"The folks who sent me the data created a weird, non-standard .csv file. 
  You'd think read.csv() could handle it."

The standard way to handle quotes in strings is to double them.  They 
didn't, so you've got a weird file on your hands.

You can probably fix it by doing a global substitution of all "backslash 
doublequote" pairs with "doublequote doublequote".  Unless they have 
some "backslash backslash doublequote" triples that they want you to 
interpret as "backslash doublequote".  Or some other weirdness.

I'd suggest you try the global subst mentioned above. or ask them for 
data in a reasonably standardized format.

Duncan Murdoch

> best,
> Tim
>
 David Winsemius  1/25/2013 4:16 PM >>>
>
> On Jan 25, 2013, at 11:35 AM, Tim Howard wrote:
>
>> Great point, your fix (quote="") works for the example I gave. 
>> Unfortunately, these text strings have commas in them as well(!).  Throw a 
>> few commas in any of the text strings and it breaks again.  Sorry about not 
>> including those in the example.
>>
>> So, I need to incorporate commas *and* quotes with the escape character 
>> within a single string.
>
> Well you need to have _some_ delimiter. At the moment it sounds as though you 
> might end upusing readLines() and strsplit( . , split="\\'\\,\\s\\").
>
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Attempting to confirm a program i wrote in C (normalize 2 datasets, transform into histogram, transform into CDF, perform KS test)

2013-01-26 Thread Tarskin
I have written a program in C that two xy datasets, aligns these 2 datasets
based on shared features, transforms them into equal sized histograms,
transforms the histograms into cumulative distribution functions (via GSL)
and finally performs a KS_test.

I am wanting to validate my program's results and figure'd i would use R but
i am kinda stuck at ithe histograms (I have 2 histogram objects with the
same #bins, weighted by the Y value) right now and not really sure how to
transform these into CDF to perform a KS.test, I looked at the edf function
but got kind of lost.

I realize this is most likely a very basic question but I am just not that
familiar with R :(

Thanks in advanc



--
View this message in context: 
http://r.789695.n4.nabble.com/Attempting-to-confirm-a-program-i-wrote-in-C-normalize-2-datasets-transform-into-histogram-transform-tp4656704.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Removal of columns from matrix where all values of the column are identical.

2013-01-26 Thread Benjamin Ward (ENV)
Hi,

I've been trying to work this out how it works, I'm still not totally sure but 
seems to me it subsets the matrix according to whether each column returns all 
TRUE, to not being the same values when you compare the column[-1] and the 
column[-length(column)], essentially siding the column against itself and 
making comparison? It seems that it also removed columns with any repeated 
values, rather than columns in which all values are the same:

testm<-matrix(nrow=5, ncol=5)
testm[,1] <- c(1,2,3,4,5)
testm[,2] <- c(3,3,3,3,3)
testm[,3] <- c(3,3,3,4,3)
testm[,4] <- c(5,4,3,2,1)
testm[,5] <- c(1,2,3,4,4)
testm

test3 <- testm[,apply(testm,2,function(x) all(c(TRUE,x[-length(x)]!=x[-1])))]
test3

test3
     [,1] [,2]
[1,]    1    5
[2,]    2    4
[3,]    3    3
[4,]    4    2
[5,]    5    1

Thanks,
Ben W.


From: arun [smartpink...@yahoo.com]
Sent: 26 January 2013 02:34
To: Benjamin Ward (ENV)
Cc: R help
Subject: Re: [R] Removal of columns from matrix where all values of the column 
are identical.

Hi,

I guess this should also work:


 Matrix[,apply(Matrix,2,function(x) all(c(TRUE,x[-length(x)]!=x[-1])))]
# [,1] [,2] [,3]
#[1,]    155
#[2,]    241
#[3,]    334
#[4,]    423
#[5,]    512
A.K.



- Original Message -
From: Benjamin Ward (ENV) 
To: "r-help@r-project.org" 
Cc:
Sent: Friday, January 25, 2013 6:17 PM
Subject: [R] Removal of columns from matrix where all values of the column are 
identical.

Hi all,

I'd like to write a piece of code which will remove columns from a matrix, if 
the column contains only one value, say every value in the column is a "3":

Matrix <- matrix(NA, nrow=5, ncol=4)
Matrix[,1] <- c(1,2,3,4,5)
Matrix[,2] <- c(3,3,3,3,3)
Matrix[,3] <- c(5,4,3,2,1)
Matrix[,4] <- c(5,1,4,3,2)

  [,1] [,2] [,3] [,4]
[1,]    1355
[2,]    2341
[3,]    3334
[4,]    4323
[5,]    5312

What I have written so far is a loop which will see if all values are the same, 
a bit of a hack since it just checks all values are equal to the first value of 
the column, if not, by definition the column cannot contain only one 
value/variable/character:

removals<-c()
for(i in 1:ncol(Matrix)){
  if(all(Matrix[,i] == Matrix[[1,i]])){
removals<-append(removals, i)
  }
}
new.Matrix <- Matrix[,-removals]

This works for matrices with numbers or characters.
My question is - is there a better or more efficient way of doing this, maybe 
with apply or something. My first thought was apply set to operate over all 
columns, but was unsure of the indexing and selecting columns to be deleted.

Thanks,

Ben W.

University of East Anglia (ENV): b.w...@uea.ac.uk
The Sainsbury Laboratory: ben.w...@sainsbury-laboratory.ac.uk

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Setting global variables inside R reference class ?

2013-01-26 Thread Praveen K
Hello,

I'm a newbie to R, I have a quesiton.

I'm a bit confused on global variable assignments.

 I have the following situation. I have 2 global variables current_idx and
previous_idx. *These 2 global variables have to be set by a method in a
reference class*.

Essentially, using <<- assignment operator should work right ? But, I get
this warning

Non-local assignment to non-field names (possibly misspelled?)

Where am I going wrong ?

Will assign(current_idx, index, envir = .GlobalEnv) work ?


Thanks !

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loop question?

2013-01-26 Thread Andras Farkas

Sorry Jeff, probably the new version of Yahoo mail doing the html, I switched 
back to the older one hope that takes care of the problem. Let me clarify the 
code below:

TINF <-1
a <-c(500,750,1000,1250,1500,1750,2000)
b <-c(8,12,18,24,36,48,60,72,96)

infcprodessa <-function (D, tin, tau, ts) 
 (D * (1 - exp(-0.048 * tin))/(tin * (0.048*79) * (1 - exp(-0.048 * tau 
* exp(-0.048 * (ts - tin))

z <-sapply(1:1, function(n) infcprodessa(a,TINF,b,b-TINF)) 

so I am looking to find the combination of a = 1000 and b = 12, which iz a 
value for "z" that would fall between 15 and 20. Sometimes though there may be 
more than one combinations that will meet criteria, in that case I would like 
to select the combination based on the smallest "a" value that has the 
respective "b" value to meet the criteria,

sorry for the confusion,

thanks,

Andras


--- On Sat, 1/26/13, Jeff Newmiller  wrote:

> From: Jeff Newmiller 
> Subject: Re: [R] Loop question?
> To: "Andras Farkas" , "r-help@r-project.org" 
> 
> Date: Saturday, January 26, 2013, 2:09 AM
> Please read the Posting Guide
> no html email
> reproducible example please
> 
> In general, you can use expand.grid to generate all
> combinations of inputs, compute results as a vector just as
> long as the expand.grid data frame has rows, and identify
> which results meet your criteria by a logical test, and use
> that test to identify which input combinations worked.
> Provide a working starting point and someone might give you
> working code as an answer. (where do a and b come into your
> problem?)
> ---
> Jeff Newmiller           
>             The 
>    .   
>    .  Go Live...
> DCN: 
>       Basics: ##.#.   
>    ##.#.  Live Go...
>                
>                
>       Live:   OO#.. Dead:
> OO#..  Playing
> Research Engineer (Solar/Batteries     
>       O.O#.   
>    #.O#.  with
> /Software/Embedded Controllers)       
>        .OO#.   
>    .OO#.  rocks...1k
> ---
> 
> Sent from my phone. Please excuse my brevity.
> 
> Andras Farkas 
> wrote:
> 
> >Dear All
> >�
> >I have the following data (somewhat simplyfied):
> >�
> >TINF <-1
> >a <-c(500,750,1000,1250,1500,1750,2000)
> >b <-c(8,12,18,24,36,48,60,72,96)
> >�
> >following function:
> >�
> >infcprodessa <-function (D, tin, tau, ts) 
> >� (D * (1 - exp(-0.048 * tin))/(tin * (0.048*79) * (1
> - exp(-0.048 *
> >tau * exp(-0.048 * (ts - tin))
> >
> >z <-sapply(1:1, function(n)
> infcprodessa(1000,TINF,12,12-TINF))
> >�
> >is there a way to select the combination of respective a
> and b values
> >that would result in a calculated z that is between 15
> and 20? In this
> >case the a would be 1000 and the b would be 12 (other
> combinations are
> >also possible), but how could I automatically find them?
> perhaps a
> >loop?
> >�
> >Apreciate the help,
> >�
> >Sincerely,
> >�
> >Andras
> >    [[alternative HTML version deleted]]
> >
> >
> >
> >
> >
> >__
> >R-help@r-project.org
> mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> >http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained,
> reproducible code.
> 
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] google APi or java popup or slide window information

2013-01-26 Thread Janue Miret, Jofre
How can I do with R an APi or java popup or slide window information ? 
I would like to generate a html or php files raster map colors, with a
numerical values, and with information popup window over each data. Do
you know any Java or gogle APi examples?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Pass vector as multiple parameters (as in python f(*x))

2013-01-26 Thread Suzen, Mehmet
This an alternating way of doing it using a list if you know the
argument names in
the function definition i.e. ?formals and ?alist, But would change
the default values of the function. Probably not you wanted.

> f <- function(x,y,z) x+y+z
> args<-alist(x=5,y=6,z=7)
> formals(f) <- args
> f()
[1] 18


On 26 January 2013 01:46, Carlos Pita  wrote:
> Thanks Bert, do.call is exactly what I was looking for. What in lisp
> is apply and in python f(*v).
>
>> Your whole premise that the arguments of a function should be mappable to 
>> elements of a vector seems contrary to good R programming practice.
>
> Jeff I didn't pretend to imply that the mapping should by always
> possible. lists for positional arguments and named lists for named
> arguments would do the trick most of the times. It's pretty common in
> dynamic languages.
>
> That said, the specific task I have in mind is to index an array of an
> arbitrary dimension n by a list of length n vectors, each one
> representing  coordinates.
>
> For example, if n=2, the array is the matrix m, and the list of vectors is vs:
>
> m=matrix(1:16,4)
> vs = list(c(2,3),c(2,2),c(1,1))
>
> Then do.call would allow me to index m as follows:
>
> lapply(vs, function(v) { do.call(`[`, append(list(m), v)) })
>
> Alternatively:
>
> f = function (...) { m[...] }
> lapply(vs, function(v) { do.call(f, as.list(v)) })
>
> Of course, I could just do m[v[1],v[2]] in this case, but the point is
> that the dimension n would be a parameter of my function, not a
> constant.
>
> But if you know of a better or more r-esque solution I would be very
> glad to hear of it.
>
> Best regards
> --
> Carlos
>
>
> Best regards
> --
> Carlos
>
> Consider changing the called function's handling of arguments instead
> to accept the vector of data directly if a vector makes sense, or to a
> list if the arguments have a variety of types.
>> ---
>> Jeff NewmillerThe .   .  Go Live...
>> DCN:Basics: ##.#.   ##.#.  Live Go...
>>   Live:   OO#.. Dead: OO#..  Playing
>> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
>> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
>> ---
>> Sent from my phone. Please excuse my brevity.
>>
>> Carlos Pita  wrote:
>>
>>>Hi,
>>>
>>>I want to know if it's possible to pass a vector v=c(x,y,...) to a
>>>function f(x,y,...) so that each vector element corresponds to a
>>>formal argument of the function. For python programmers: f(*v).
>>>
>>>Specifically, what I'm trying to achieve is: given a list of
>>>coordinates l=list(c(x1,y1,z1), c(x2,y2,z2),...) I would like to
>>>obtain the corresponding elements in some array A (3-dim in this
>>>case). That is: A[x1,y1,z1], A[x2,y2,z2],
>>>
>>>One way would be to transform l=list(c(x1,y1,z1), c(x2,y2,z2),...) to
>>>l2=list(c(x1,x2,...),c(y1,y2,...),c(z1,z2,...)) and then (if this is
>>>possible at all) execute the equivalent to A[*l2].
>>>
>>>Another way would be to lapply function(xyz) { A[*xyz] } to each
>>>coordinate vector in l. In any case I need the f(*v) equivalent.
>>>
>>>Please take into account that, despite the 3-dim example, I need to
>>>implement the above to accept n-dim vectors for arbitrary n, so
>>>something like x<-xyz[1], y<-xyz[2], z<-xyz[3] wouldn't fit the bill.
>>>
>>>Any other suggested solution would be appreciated.
>>>
>>>Best regards
>>>--
>>>Carlos
>>>
>>>__
>>>R-help@r-project.org mailing list
>>>https://stat.ethz.ch/mailman/listinfo/r-help
>>>PLEASE do read the posting guide
>>>http://www.R-project.org/posting-guide.html
>>>and provide commented, minimal, self-contained, reproducible code.
>>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] joint probability distribution

2013-01-26 Thread John Kane
 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

John Kane
Kingston ON Canada


> -Original Message-
> From: eliza_bo...@hotmail.com
> Sent: Fri, 25 Jan 2013 18:13:55 +
> To: r-help@r-project.org
> Subject: [R] joint probability distribution
> 
> 
> Dear R family,
> I want to calculate the joint probability (distribution) of two random
> continuous variables X and Y.
> Could to please tell me how to do it?Thanks in advance..
> elisa
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.csv quotes within fields

2013-01-26 Thread John Kane
Following David's suggestion you might want to have a look at 
https://confluence.clazzes.org/display/CSVEDIT/CSVEdit+Home .

 I have not used it but it seems to get good reviews from people I know.

John Kane
Kingston ON Canada


> -Original Message-
> From: dwinsem...@comcast.net
> Sent: Fri, 25 Jan 2013 13:42:25 -0800
> To: tghow...@gw.dec.state.ny.us
> Subject: Re: [R] read.csv quotes within fields
> 
> 
> On Jan 25, 2013, at 1:37 PM, Tim Howard wrote:
> 
>> David,
>> Thank you again for the reply. I'll try to make readLines() and
>> strplit() work.  What bugs me is that I think it would import fine if
>> the folks who created the csv had used double quotes "" rather than an
>> escaped quote \" for those pesky internal quotes. Since that's the case,
>> I'd think there would be a solution within read.csv() ... or perhaps
>> scan()?, I just can't figure it out.
> 
> Can you pre-process with an editor? Replace all the ", " hits with
> something like '|'.
> 
> --
> David.
>> best,
>> Tim
>> 
> David Winsemius  1/25/2013 4:16 PM >>>
>> 
>> On Jan 25, 2013, at 11:35 AM, Tim Howard wrote:
>> 
>>> Great point, your fix (quote="") works for the example I gave.
>>> Unfortunately, these text strings have commas in them as well(!).
>>> Throw a few commas in any of the text strings and it breaks again.
>>> Sorry about not including those in the example.
>>> 
>>> So, I need to incorporate commas *and* quotes with the escape character
>>> within a single string.
>> 
>> Well you need to have _some_ delimiter. At the moment it sounds as
>> though you might end upusing readLines() and strsplit( . ,
>> split="\\'\\,\\s\\").
>> 
>> --
>> david.
>> 
>>> 
>>> Tim
>>> 
>>> 
>> David Winsemius  1/25/2013 2:27 PM >>>
>>> 
>>> On Jan 25, 2013, at 10:42 AM, Tim Howard wrote:
>>> 
 All,
 
 I have some csv files I am trying to import. I am finding that quotes
 inside strings are escaped in a way R doesn't expect for csv files.
 The problem only seems to rear its ugly head when there are an uneven
 number of internal quotes. I'll try to recreate the problem:
 
 # set up a matrix, using escape-quote as the internal double quote
 mark.
 
 x <- data.frame(matrix(data=c("1", "string one", "another string",
 "2", "quotes escaped 10' 20\" 5' 30\" \"test string", "final string",
 "3","third row","last \" col"),ncol = 3, byrow=TRUE))
 
> write.csv(x, "test.csv")
 
 # NOTE that write.csv correctly created the three internal quotes ' "
 ' by using double quotes ' "" '.
 # here's what got written
 
 "","X1","X2","X3"
 "1","1","string one","another string"
 "2","2","quotes escaped 10' 20"" 5' 30"" ""test string","final string"
 "3","3","third row","last "" col"
 
 # Importing test.csv works fine.
 
> read.csv("test.csv")
  X X1 X2 X3
 1 1  1 string one another string
 2 2  2 quotes escaped 10' 20" 5' 30" "test string   final string
 3 3  3  third row last " col
 # this looks good.
 # now, please go and open "test.csv" with a text editor and replace
 all the double quotes '""' with the
 # quote escaped ' \" ' as is found in my data set. Like this:
 
 "","X1","X2","X3"
 "1","1","string one","another string"
 "2","2","quotes escaped 10' 20\" 5' 30\" \"test string","final string"
 "3","3","third row","last \" col"
>>> 
>>> Use quote="":
>>> 
 read.csv(text='"","X1","X2","X3"
>>> + "1","1","string one","another string"
>>> + "2","2","quotes escaped 10\' 20"" 5\' 30"" ""test string","final
>>> string"
>>> + "3","3","third row","last "" col"', sep=",", quote="")
>>> 
>>> Not , quote="\""
>>> 
>>> 
>>>   X.. X.X1.   X.X2.
>>> X.X3.
>>> 1 "1"   "1""string one" "another
>>> string"
>>> 2 "2"   "2" "quotes escaped 10' 20"" 5' 30"" ""test string"   "final
>>> string"
>>> 3 "3"   "3" "third row""last ""
>>> col"
>>> 
>>> You will then be depending entirely on commas to separate.
>>> 
>>> (Needed to use escaped single quotes to illustrate from a command
>>> line.)
>>> 
 
 # this breaks read.csv:
 
> read.csv("test.csv")
  X X1
 X2 X3
 1 1  1
 string one another string
 2 2  2 quotes escaped 10' 20\\ 5' 30\\ \\test ( file://\test )
 string,final string\n3,3,third row,last \\ col
 
 # we now have only two rows, with all the data captured in col2 row2
 
 Any suggestions on how to fix this behavior? I've tried fiddling with
 quote="\"" to no avail, obviously. Interestingly, an even number of
 escaped quotes within a field is loaded correctly, which certainly
 threw me for a while!
 
 Thank you in advance,
 Tim
 
 
>>> 
>>> David Winsemius
>>> Alam

Re: [R] importing data

2013-01-26 Thread David Hugh-Jones
Hi Ray,
Comments below:

On 26 January 2013 09:03, Ray Cheung  wrote:
[snip]
> ###FUNCTION TO READ FILES
> little_helpful <- function(n) {
> file_name <- paste0("C:/.../data", n, ".dat")
> read.table(file_name)
> }
>
> ###RETURN AN OBJECT WHICH CHECKS FOR THE EXISTENCE OF FILES
> check  <- function(n) {
> a <- ifelse(file.exists(paste0("C:/.../data", n, ".dat")), 1, 0)
> a
> }

Too complex. Why not just use file.exists directly?

> ###Combining the functions
> IMPORT <- function(n) {
>L <- check(1:n)
>for (i in 1:n) {
>   if (L[i] == 1)
>   list_of_datasets <- lapply(i, little_helpful) else list_of_datasets
> <- 0
>   }
>list_of_datasets
>}
>

Too complex here too. I suggest something like:

M <- list()
for (i in 1:n) {
> file_name <- paste0("C:/.../data", n, ".dat")
  if (file.exists(file_name)) M[i] <- read.table(file_name)
}

R gurus don't like for() loops, but they are easy for humans to understand.
If this doesn't work, post the error message.


> Thanks for all comments.
>
> Best Regards,
> Ray
>
> On Fri, Jan 25, 2013 at 5:48 PM, Ivan Calandra > wrote:
>
>> Hi,
>>
>> Not sure this is what you need, but what about list.files()?
>> It can get you all the files from a given folder, and you could then work
>> this list with regular expressions for example.
>>
>> HTH,
>> Ivan
>>
>> --
>> Ivan CALANDRA
>> Université de Bourgogne
>> UMR CNRS/uB 6282 Biogéosciences
>> 6 Boulevard Gabriel
>> 21000 Dijon, FRANCE
>> +33(0)3.80.39.63.06
>> ivan.calan...@u-bourgogne.fr
>> http://biogeosciences.u-**bourgogne.fr/calandra
>>
>> Le 25/01/13 10:00, R. Michael Weylandt a écrit :
>>
>>> On Fri, Jan 25, 2013 at 6:11 AM, Ray Cheung  wrote:
>>>
 Dear Michael,

 Thanks for your codes. However, lapply does not work in my case since
 I've
 some files missing in the data (say, the file data101.dat). Do you have
 any
 suggestions on this?? Thank you very much.

  You could simply add a test using file.exists() but I'm not sure what
>>> you want to do with the M matrix then -- omit the slice (so the others
>>> are all shifted down one) or fill it entirely with NA's.
>>>
>>> Michael
>>>
>>> __**
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/**
>>> posting-guide.html 
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>> __**
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html 
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> [[alternative HTML version deleted]]
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] importing data

2013-01-26 Thread Ray Cheung
Thanks for your commands, Ivan and Michael! However, I am still not
producing the right codes. Would you please help me on this? I've written
the following codes. Please comment. Thank you very much.

Task: Reading data1.dat to data1000.dat (with missing files) into R.
Missing files can be omitted in the list.

###FUNCTION TO READ FILES
little_helpful <- function(n) {
file_name <- paste0("C:/.../data", n, ".dat")
read.table(file_name)
}

###RETURN AN OBJECT WHICH CHECKS FOR THE EXISTENCE OF FILES
check  <- function(n) {
a <- ifelse(file.exists(paste0("C:/.../data", n, ".dat")), 1, 0)
a
}
###Combining the functions
IMPORT <- function(n) {
   L <- check(1:n)
   for (i in 1:n) {
  if (L[i] == 1)
  list_of_datasets <- lapply(i, little_helpful) else list_of_datasets
<- 0
  }
   list_of_datasets
   }

Thanks for all comments.

Best Regards,
Ray

On Fri, Jan 25, 2013 at 5:48 PM, Ivan Calandra  wrote:

> Hi,
>
> Not sure this is what you need, but what about list.files()?
> It can get you all the files from a given folder, and you could then work
> this list with regular expressions for example.
>
> HTH,
> Ivan
>
> --
> Ivan CALANDRA
> Université de Bourgogne
> UMR CNRS/uB 6282 Biogéosciences
> 6 Boulevard Gabriel
> 21000 Dijon, FRANCE
> +33(0)3.80.39.63.06
> ivan.calan...@u-bourgogne.fr
> http://biogeosciences.u-**bourgogne.fr/calandra
>
> Le 25/01/13 10:00, R. Michael Weylandt a écrit :
>
>> On Fri, Jan 25, 2013 at 6:11 AM, Ray Cheung  wrote:
>>
>>> Dear Michael,
>>>
>>> Thanks for your codes. However, lapply does not work in my case since
>>> I've
>>> some files missing in the data (say, the file data101.dat). Do you have
>>> any
>>> suggestions on this?? Thank you very much.
>>>
>>>  You could simply add a test using file.exists() but I'm not sure what
>> you want to do with the M matrix then -- omit the slice (so the others
>> are all shifted down one) or fill it entirely with NA's.
>>
>> Michael
>>
>> __**
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html 
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
> __**
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/**listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/**
> posting-guide.html 
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loop question?

2013-01-26 Thread David Hugh-Jones
Here's a toy example which you can apply the logic of:

dfr <- expand.grid(1:3,1:2)
results <- apply(dfr, 1, sum)
dfr[results==4,]





On 25 January 2013 22:19, Andras Farkas  wrote:
>
> Dear All
>
> I have the following data (somewhat simplyfied):
>
> TINF <-1
> a <-c(500,750,1000,1250,1500,1750,2000)
> b <-c(8,12,18,24,36,48,60,72,96)
>
> following function:
>
> infcprodessa <-function (D, tin, tau, ts)
>   (D * (1 - exp(-0.048 * tin))/(tin * (0.048*79) * (1 - exp(-0.048 * tau 
> * exp(-0.048 * (ts - tin))
>
> z <-sapply(1:1, function(n) infcprodessa(1000,TINF,12,12-TINF))
>
> is there a way to select the combination of respective a and b values that 
> would result in a calculated z that is between 15 and 20? In this case the a 
> would be 1000 and the b would be 12 (other combinations are also possible), 
> but how could I automatically find them? perhaps a loop?
>
> Apreciate the help,
>
> Sincerely,
>
> Andras
> [[alternative HTML version deleted]]
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.