Re: [R] IFELSE function XXXX

2011-04-05 Thread Ben Bolker
William Dunlap tibco.com> writes: > Avoid assignments in arguments to function calls, especially > multiple assignments to the same object, except when you know > what you are doing and want to write obscure code. > > Change the above line to > data3$input1 <- ifelse(data3$res1==1, data3$input

Re: [R] IFELSE function XXXX

2011-04-05 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Dan Abner > Sent: Tuesday, April 05, 2011 12:58 PM > To: r-help@r-project.org > Subject: [R] IFELSE function > > Hello everyone, > > Th

[R] IFELSE function XXXX

2011-04-05 Thread Dan Abner
Hello everyone, This IFELSE function call is not working properly. I do not receive an error message, but the actions are not executed conditional as I was hoping. Any assistance is appreciated. set.seed(12345) res1<-rbinom(1,1,.1) rdata3<-transform(data.frame(res1),input1=rnorm(1,50,10))

Re: [R] ifelse function

2007-11-27 Thread Steven McKinney
quot;) [1] "aa" "ao" "dcl" "iy" "sh" > Hope this helps Best Steven McKinney -Original Message- From: [EMAIL PROTECTED] on behalf of Min (Tilda) Zhang Sent: Tue 11/27/2007 7:45 PM To: r-help@r-project.org Subject: [R] ifelse functi

[R] ifelse function

2007-11-27 Thread Min (Tilda) Zhang
Hi there, I need help with IFELSE function. The column g of my dataset pth, pth$g consists of "aa", "ao", "dcl", "iy", "sh". The last few values of pth$g looks like: [4496] sh ao ao sh iy dcl dcl aa iy iy aa sh ao ao Levels: aa ao dcl iy sh I want to convert these values into 1,2,3,4