6-02-2012, 11:03 (-0800); Judith Flores escriu:
> The name of the column will be saved in an object called:
>
> variab
>
> the data frame is called df.
>
>
> If I try to the do following:
>
> df[variab]<-factor(df[variab], levels=c("A2B","B31","C33"))
>
> it won't work because df[variab] is
Hi Judith,
You should use double brackets, like this:
df[[variab]]<-factor(df[[variab]], levels=c("A2B","B31","C33"))
see ?"[" for details, noting that the help page assumes that you know
data.frames are list-like objects.
Best,
Ista
On Mon, Feb 6, 2012 at 2:03 PM, Judith Flores wrote:
> Hell
2 matches
Mail list logo