Re: [R] xyplot and lwd

2013-09-08 Thread Daniel Hornung
On Thursday, September 05, 2013 16:39:14 Bert Gunter wrote: > Daniel: > > I wondered if that might be what you meant ... > > To amplify a bit on David's response, the answer is that you do **not** > have separate control over the line width of characters -- lwd controls the > width of lines in a

Re: [R] Package installation and path.package

2013-09-08 Thread Prof Brian Ripley
On 09/09/2013 02:09, David Winsemius wrote: On Sep 8, 2013, at 8:00 AM, Simon Zehnder wrote: Dear R-Users and R-Devels, I am writing right now my own package that makes use of 'tempfile' and there within with 'path.package'. When I install it, I get the error: Error in path.package("mypacka

Re: [R] Use of parantheses to force order of execution

2013-09-08 Thread Ben Harrison
Thank you all for the replies. BWS6 is a data frame, but actually the main problem in my code as Duncan points out is that the statement inside the parentheses modifies BWS6 anyway. I need to rework my code. I coded my missing values for these data sets as -999.25 (a hangover from another piece o

Re: [R] Package installation and path.package

2013-09-08 Thread David Winsemius
On Sep 8, 2013, at 8:00 AM, Simon Zehnder wrote: > Dear R-Users and R-Devels, > > I am writing right now my own package that makes use of 'tempfile' and there > within with 'path.package'. When I install it, I get the error: Error in > path.package("mypackage") : none of the packages are loade

Re: [R] Subsetting isolating a group of values in a group of variables

2013-09-08 Thread arun
Hi Razi, Using dat1: dat1[apply(dat1[,2:4],1,function(x) any(x%in% vec1)),] #  ID diag1 diag2 diag3 proc1 proc2 proc3 #2  2   k69   i80  u456  z456  z123  z456 #3  3   l91  i801  g678  u456  u123  u123 #4  4   i80   i90  h983  z123  z456  z456 #similarly, if the columns are from 18:93, change ac

Re: [R] Create a new column based on values in two other columns

2013-09-08 Thread arun
HI, df$NewPrices<- unsplit(lapply(split(df,df$Stocks),function(x) {do.call(rbind,lapply(seq_len(nrow(x)),function(i) {if(x[i,]$Offsets==2)                                     x[i+2,]$Prices                                         else if(x[i,]$Offsets==1)                                      

Re: [R] Need Help

2013-09-08 Thread peter dalgaard
On Sep 8, 2013, at 19:08 , Rhode Early CHARLES wrote: > Good morning > I am trying to read this file in R. > > Nome AK 2.5 15 Miami FL 6.75 > 18 Raleigh NC . 12 > > > This what the code is for SAS, I ma trying to di the same in R. > > Input more than one observation from each record; > DATA

Re: [R] CHAID Analysis in R

2013-09-08 Thread Achim Zeileis
On Sun, 8 Sep 2013, Ekta Jain wrote: Dear all, I have been researching on whether there is a package in R that can do CHAID analysis. The CHAID package in R-Forge is not available for windows and thus wondering if at all there is something equivalent in R? I have just triggered a rebuild on R-

[R] ADF test

2013-09-08 Thread Jose Narillos de Santos
Hi all, I try to simulate an ADF test rolling on a window. The thing is that it seems I´m doing well...applying to al AR(1) model with unit root. I see in some econometrical papers that the t-stat maximum and minimum should have negative values on the quantiles 0,01 to 0,03 and in my case only

Re: [R] to avoid a do loop

2013-09-08 Thread Arnaud Michel
Hi This below system.time of the 3 solutions with a large dataframe df1 (nrow=55000). # Arun system.time(df1$CatEch1 <- paste0(df1$Cat,".",sprintf("%02d",df1$Ech))) # user system elapsed # 0.060.000.06 # Rui Barradas system.time(df1$CatEch2 <- pastedf1$Cat, sprintf("%02d", df1$Ech),

[R] Need Help

2013-09-08 Thread Rhode Early CHARLES
Good morning I am trying to read this file in R.   Nome AK 2.5 15 Miami FL 6.75 18 Raleigh NC . 12 This what the code is for SAS, I ma trying to di the same in R. Input more than one observation from each record; DATA rainfall; INFILE ’c:\MyRawData\Precipitation.dat’; INPUT City $ State $ N

Re: [R] melting a data frame

2013-09-08 Thread Data Analytics Corp.
Hi, I received several really good suggestions, but the feeling seems to be to use a for loop. I did this at first, but my curiosity took over -- hence, my question. The loop, coupled with a list of relevant columns, seems best. Thanks all, Walt Walter R. Paczko

[R] CHAID Analysis in R

2013-09-08 Thread Ekta Jain
Dear all, I have been researching on whether there is a package in R that can do CHAID analysis. The CHAID package in R-Forge is not available for windows and thus wondering if at all there is something equivalent in R? Many Thanks, Ekta [[alternative HTML version deleted]] _

Re: [R] to avoid a do loop

2013-09-08 Thread Arnaud Michel
Thanks to all three for your fast answer Michel Le 08/09/2013 18:41, Renaud Lancelot a écrit : > paste(df1$Cat, > formatC(df1$Ech, flag = "0", width = max(nchar(df1$Ech))), > sep = ".") > > > > 2013/9/8 Arnaud Michel > > > Hello > I have a large

Re: [R] to avoid a do loop

2013-09-08 Thread Renaud Lancelot
paste(df1$Cat, formatC(df1$Ech, flag = "0", width = max(nchar(df1$Ech))), sep = ".") 2013/9/8 Arnaud Michel > Hello > I have a large dataframe (nrow=55000). > This below df1 an extract of the original dataframe > > dput(df1) > structure(list(Cat = c(6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4

Re: [R] to avoid a do loop

2013-09-08 Thread Rui Barradas
Hello, Try the following. df3 <- df1 df3$CatEch <- paste(df1$Cat, sprintf("%02d", df1$Ech), sep = ".") identical(df2, df3) # TRUE Hope this helps, Rui Barradas Em 08-09-2013 17:22, Arnaud Michel escreveu: Hello I have a large dataframe (nrow=55000). This below df1 an extract of the orig

Re: [R] to avoid a do loop

2013-09-08 Thread arun
Hi, Try: df1$CatEch<-paste0(df1[,1],".",sprintf("%02d",df1[,2]))  identical(df1,df2) #[1] TRUE A.K. - Original Message - From: Arnaud Michel To: R help Cc: Sent: Sunday, September 8, 2013 12:22 PM Subject: [R] to avoid a do loop Hello I have a large dataframe  (nrow=55000). This belo

[R] to avoid a do loop

2013-09-08 Thread Arnaud Michel
Hello I have a large dataframe (nrow=55000). This below df1 an extract of the original dataframe dput(df1) structure(list(Cat = c(6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, 8, 8, 9, 9, 9, 9, 9, 9, 9, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8

[R] Package installation and path.package

2013-09-08 Thread Simon Zehnder
Dear R-Users and R-Devels, I am writing right now my own package that makes use of 'tempfile' and there within with 'path.package'. When I install it, I get the error: Error in path.package("mypackage") : none of the packages are loaded. I understand the error, but I would like to have a worka

Re: [R] Use of parantheses to force order of execution

2013-09-08 Thread peter dalgaard
On Sep 8, 2013, at 16:09 , Duncan Murdoch wrote: > On 13-09-08 6:46 AM, Ben Harrison wrote: >> Hello, >> I wish to create a copy of a data frame, but with missing values replaced >> with NAs. >> >> I thought I should be able to do it in one step using parentheses to group >> the statements and f

Re: [R] Sub setting multiple ids based on a 2nd data frame

2013-09-08 Thread arun
Hi, The ?as.numeric() in 'indx' is not needed.  indx1<-(as.Date(AB$Start)<= as.Date(AB$Date)) & (as.Date(AB$Date) <= as.Date(AB$End))  identical(indx,indx1) #[1] TRUE  AB[indx1,-c(5:7)] A.K. - Original Message - From: arun To: R help Cc: Matthew Guzzo Sent: Sunday, September 8, 201

Re: [R] melting a data frame

2013-09-08 Thread John Fox
Dear Walt and A.K., One shouldn't reflexively avoid loops in R. In this case, it seems to me clearer to use a loop, and it's no less "efficient" (especially, I would guess, when one takes into account the time to figure out how to do the computation). I get > system.time({ + res<-do.call(rbin

Re: [R] Use of parantheses to force order of execution

2013-09-08 Thread Duncan Murdoch
On 13-09-08 6:46 AM, Ben Harrison wrote: Hello, I wish to create a copy of a data frame, but with missing values replaced with NAs. I thought I should be able to do it in one step using parentheses to group the statements and force those inside the parens to execute first: df <- (BWS6[BWS6 < -9

Re: [R] melting a data frame

2013-09-08 Thread arun
Forgot:  res2<-subset(res1,select= -c(time,id)) A.K. - Original Message - From: arun To: "w...@dataanalyticscorp.com" Cc: R help Sent: Sunday, September 8, 2013 9:49 AM Subject: Re: [R] melting a data frame Hi, You may also try ?reshape() dat2<- dat1 names(dat2)[-c(1:21)]<- paste(r

Re: [R] melting a data frame

2013-09-08 Thread arun
Hi, You may also try ?reshape() dat2<- dat1 names(dat2)[-c(1:21)]<- paste(rep(names(dat2)[1:21],8),rep(2:9,each=21),sep="_") names(dat2)[1:21]<- paste(names(dat2)[1:21],rep(1,21),sep="_") res1<- reshape(dat2,direction="long",varying=1:ncol(dat2),sep="_") row.names(res1)<- 1:nrow(res1) attr(res1,"r

Re: [R] melting a data frame

2013-09-08 Thread arun
Hi, You could try: set.seed(48) dat1<- as.data.frame(matrix(sample(1:40,189*130,replace=TRUE),ncol=189)) res<-do.call(rbind,lapply(split(colnames(dat1),((seq_len(ncol(dat1))-1)%/%21)+1),function(x) {x1<- dat1[,x]; colnames(x1)<- paste("V",1:21);x1}))  row.names(res)<- 1:nrow(res)  dim(res) #[1]

[R] melting a data frame

2013-09-08 Thread Data Analytics Corp.
Hi, Suppose I have a data frame with 189 columns. The columns are actually 9 blocks of 21 columns each, each block representing measures on each of 9 products. There are 130 rows. Suppose I extract the first block of 21 columns and make them into a separate data frame. I then want to take

[R] Use of parantheses to force order of execution

2013-09-08 Thread Ben Harrison
Hello, I wish to create a copy of a data frame, but with missing values replaced with NAs. I thought I should be able to do it in one step using parentheses to group the statements and force those inside the parens to execute first: df <- (BWS6[BWS6 < -998] <- NA) But all this does is assign NA