[R] pipe or system command

2013-04-04 Thread nalluri pratap
Hi,   In SAS I have something like   %let dirname = c:\work\raw_data_files; filename DIRLIST pipe "dir /B &dirname\*.txt";   Can someone help me to convert this to R. I tried with system and pipe, but It actually creates a file on the disk which I don't like. I just need to have a reference to th

Re: [R] Looping through rows of all elements of a list that has variable length

2013-02-04 Thread nalluri pratap
Just modified your code a bit, hope this helps:   a=expand.grid(1:2,1:2) b=expand.grid(1:2,1:2,1:2) c=expand.grid(1:2,1:2,1:2,1:2) l.long<-list(a,b,c) mygrid<-do.call(expand.grid,lapply(l.long,function(x) 1:nrow(x))) out<-vector("list",nrow(mygrid)) for(gridrow in 1:nrow(mygrid)) {   sum_rows=0

Re: [R] order function

2013-02-02 Thread nalluri pratap
I agree with Duncan.   may be you need this   format(output[order(output[,3]),],scientific=T)   Pratap --- On Sat, 2/2/13, Duncan Murdoch wrote: From: Duncan Murdoch Subject: Re: [R] order function To: "Kripa R" Cc: r-help@r-project.org Date: Saturday, 2 February, 2013, 4:19 AM On 13-02-01

Re: [R] Filter according to the latest data

2013-02-01 Thread nalluri pratap
library(sqldf) k1<-data.frame(ID=LETTERS[1:4], No=c(rep(123,3),111), Change=c("final","error","bug fixed","final"), Date=c("2013-01-15","2013-01-16","2013-01-17","2013-01-12"))   k1$Date=as.Date(as.character(k1$Date),tz=UK)   sqldf("select * from k1 group by No having max(Date)") --- On Fri, 1/2

Re: [R] Transforming 4x3 data frame into 2 column df in R

2013-02-01 Thread nalluri pratap
newdf<-data.frame(k1=rep(row.names(foo),ncol(foo)),stack(foo)) --- On Fri, 1/2/13, Gundala Viswanath wrote: From: Gundala Viswanath Subject: [R] Transforming 4x3 data frame into 2 column df in R To: "r-h...@stat.math.ethz.ch" Date: Friday, 1 February, 2013, 11:30 AM I have the following dat

Re: [R] RandomForest and Missing Values

2013-01-30 Thread nalluri pratap
If you wish to remove missing values, you can use the option na.action=na.omit.If you wish to Impute you can use rfImpute. --- On Mon, 28/1/13, Lorenzo Isella wrote: From: Lorenzo Isella Subject: [R] RandomForest and Missing Values To: r-h...@stat.math.ethz.ch Date: Monday, 28 January, 2013,

Re: [R] Relative Risk in logistic regression

2013-01-30 Thread nalluri pratap
Example from linear regression help (?lm)   ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2,10,20, labels=c("Ctl","Trt")) weight <- c(ctl, trt) lm.D9 <- lm(weight ~ group) lm.D90 <- lm(weight ~ group - 1)   predic

Re: [R] Relative Risk in logistic regression

2013-01-30 Thread nalluri pratap
Relative risk = exp(coef(model)) --- On Wed, 30/1/13, aminreza Aamini wrote: From: aminreza Aamini Subject: [R] Relative Risk in logistic regression To: "R-help" Date: Wednesday, 30 January, 2013, 4:19 PM Hi all, I am very grateful to all those who write to me 1) how i  can  obtain relative

Re: [R] recoding variables again :(

2013-01-30 Thread nalluri pratap
dat1$VARNEW<-rep("unknown",nrow(dat1)) dat1$VARNEW[dat1$RES_STA=="X" & dat1$BIRTHPLACE %in% c("AG","AI","AR","BE","ZH")]<-"swiss" --- On Wed, 30/1/13, arun wrote: From: arun Subject: Re: [R] recoding variables again :( To: "stude...@gmail.com" Cc: "R help" Date: Wednesday, 30 January, 2013,

Re: [R] Fastest way to compare a single value with all values in one column of a data frame

2013-01-30 Thread nalluri pratap
Hi Dimitri,   Does this help?   k1<-data.frame(item=sample(rep(letters),10,replace=T),a=c(1:10),b=11:20) k2<-data.frame(item="f",a=3,b=10) merge<-function(y,x) { if(y$a>min(x$a)) {   x<-rbind(x,y)   x<-x[-which.min(x$a),] } return(x) } merge(k2,k1)   or much faster way would be to refer "library(sq

Re: [R] Subsetting rows by multiple levels of selected values

2012-08-14 Thread nalluri pratap
merge(df1,df2) --- On Wed, 15/8/12, Jun Shen wrote: From: Jun Shen Subject: [R] Subsetting rows by multiple levels of selected values To: "R-help" Date: Wednesday, 15 August, 2012, 12:35 AM Dear list, Let's say we have a data frame as follows, >expand.grid(a=1:5,b=c(1,5,10,20),DV=c(0.1,0.

Re: [R] Not able to filter factor, class

2012-08-14 Thread nalluri pratap
I agree with John. Can you check that?   length(which(inclusion$Value == 0)) Pratap --- On Wed, 15/8/12, John Kane wrote: From: John Kane Subject: Re: [R] Not able to filter factor, class To: "Sri krishna Devarayalu Balanagu" , "r-help@r-project.org" Date: Wednesday, 15 August, 2012, 12:37

[R] gsub

2012-06-14 Thread nalluri pratap
Hi,   I have a string t1="(Ithis) I(test)". I need to get t2="(Ithis) test".   Can someone look into this. ?I have tried using gsub("I[^)]","",t1) , but didn't get the required result.   Thanks, Pratap [[alternative HTML version deleted]] __ R-

Re: [R] how to retrieve some records from a dataframe

2008-10-31 Thread nalluri pratap
Df[1:30,] --- On Fri, 31/10/08, Kurapati, Ravichandra (Ravichandra) <[EMAIL PROTECTED]> wrote: From: Kurapati, Ravichandra (Ravichandra) <[EMAIL PROTECTED]> Subject: [R] how to retrieve some records from a dataframe To: r-help@r-project.org Date: Friday, 31 October, 2008, 2:14 PM Hi ,

Re: [R] inserting values for null

2008-09-17 Thread nalluri pratap
The group would be happy to answer your question if you can show an example data frame on what is there and what is required.   Cheers, Pratap --- On Wed, 17/9/08, Rajasekaramya <[EMAIL PROTECTED]> wrote: From: Rajasekaramya <[EMAIL PROTECTED]> Subject: [R] inserting values for null To: r-help@

Re: [R] HI

2008-09-17 Thread nalluri pratap
If you have read the table as a data frame say, DF then the following should work   DF[DF==0]<-NA --- On Tue, 16/9/08, Amit Patel <[EMAIL PROTECTED]> wrote: From: Amit Patel <[EMAIL PROTECTED]> Subject: [R] HI To: r-help@r-project.org Date: Tuesday, 16 September, 2008, 7:02 PM Does anyone kno

Re: [R] Form Pairs of Variables for a paired t-test

2008-01-29 Thread nalluri pratap
Thanks a lot! Its working fine Pratap Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: Try this: lapply(apply(combn(ncol(x),2), 2, function(y)x[,y]), function(z)t.test(z[,1], z[,2])) On 29/01/2008, nalluri pratap wrote: > Hi Users, > > This is regarding the paired t

[R] Form Pairs of Variables for a paired t-test

2008-01-29 Thread nalluri pratap
Hi Users, This is regarding the paired t-test. I have 5 variables (say) Data$v1,Data$v2,Data$v3,Data$v4,Data$v5 in my data frame. Now, I need to perform a paired t-test on all the possible 10 pairs.How do I set up the pairs table directly and pass those variables in to t-test. Thanks

[R] Deleting the White Space in an R graph

2007-10-10 Thread nalluri pratap
Hi All, Is there a way we can delete the empty white space around when we generate any graph/map using R? The final output should be onaly a picture with no white spaces all around. Cheers, Pratap - 5, 50, 500, 5000 - Store N number of mails