Re: [R] "factorise" variables in a data.frame

2009-04-03 Thread baptiste auguie
Excellent! I felt it was fairly trivial but i can be quite dense on Friday mornings. I really like the generalisation. Many thanks, baptiste On 3 Apr 2009, at 12:11, Wacek Kusnierczyk wrote: baptiste auguie wrote: Dear list, I often need to convert several variables from numeric or in

Re: [R] "factorise" variables in a data.frame

2009-04-03 Thread Wacek Kusnierczyk
baptiste auguie wrote: > Dear list, > > I often need to convert several variables from numeric or integer into > factors (before plotting, for instance), as in the following example, > > > d <- data.frame( > x = seq(1, 10), > y = seq(1, 10), > z = rnorm(10), > a = letters[1:10]) >

[R] "factorise" variables in a data.frame

2009-04-03 Thread baptiste auguie
Dear list, I often need to convert several variables from numeric or integer into factors (before plotting, for instance), as in the following example, d <- data.frame( x = seq(1, 10), y = seq(1, 10), z = rnorm(10), a = letters[1:10]) d2 <- within(d,