Thanks, you're a lifesaver.
-J
2010/3/30 Henrique Dallazuanna :
> Using lapply:
>
> as.data.frame(lapply(df, cut, breaks = c(-Inf, 3, 8, 16), labels =
> c('x', 'y', 'z')))
>
>
> On Tue, Mar 30, 2010 at 10:14 AM, johannes rara
> wrote:
>> Thanks John and Henrique, my intention is to do this for
Using lapply:
as.data.frame(lapply(df, cut, breaks = c(-Inf, 3, 8, 16), labels =
c('x', 'y', 'z')))
On Tue, Mar 30, 2010 at 10:14 AM, johannes rara wrote:
> Thanks John and Henrique, my intention is to do this for A, B and C
> (all at once), so I'll have to wrap your solution into lapply or for
Thanks John and Henrique, my intention is to do this for A, B and C
(all at once), so I'll have to wrap your solution into lapply or for
loop?
-J
2010/3/30 Henrique Dallazuanna :
> You could try this also:
>
> cut(df$A, c(-Inf, 3, 8), labels = c('x', 'y'))
>
> On Tue, Mar 30, 2010 at 8:30 AM, joh
You could try this also:
cut(df$A, c(-Inf, 3, 8), labels = c('x', 'y'))
On Tue, Mar 30, 2010 at 8:30 AM, johannes rara wrote:
> Hi,
>
> Is there an efficient way recoding variables in a data.frame using
> base R? My purpose is to create
> new variables and attach them into old data.frame. The ba
Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
> Behalf Of johannes rara
> Sent: March-30-
Hi,
Is there an efficient way recoding variables in a data.frame using
base R? My purpose is to create
new variables and attach them into old data.frame. The basic idea is
shown below, but how to create recoding for A, B and C and assing them
into new variables?
df <- data.frame(A = c(1:5),
B = c
6 matches
Mail list logo