Re: [R] ifelse

2009-10-24 Thread pking
t; [1] 461 213 238 249 251 >> >> ifelse ( ddd>360, ddd-360, ddd ) > [1] 101 213 238 249 251 >> print(ddd) > [1] 461 213 238 249 251 >> > > Which is perfectly reasonable given that the ifelse does not change the > ddd object. > > > >

[R] ifelse

2009-10-24 Thread pking
When I run this code from an R-script: ddd = 360 + round ( atan2(-u,-v) / d2r ) print(class(ddd)) print(ddd) ifelse ( ddd>360, ddd-360, ddd ) print(ddd) I get this output: [1] "numeric" [1] 461 213 238 249 251 [1] 461 213 238 249 251 Why does ifel