Hi,

df
    ht area
1  320    3
2  410    4
3  230    2
4  360    3
5  126    1
6  280    2
7  260    2
8  280    2
9  280    2
10 260    2

df$area <- as.factor(df$area)
levels(df$area) <- c("I", "II", "III", "IV")



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

On 10/08/07, Jabez Wilson <[EMAIL PROTECTED]> wrote:
>
> Dear R Help,
> I have a set of data of heights of trees described by area that they are
> in. The areas are numerical (0 to 7).
>
>     ht    area
> 1   320   3
> 2   410   4
> 3   230   2
> 4   360   3
> 5   126   1
> 6   280   2
> 7   260   2
> 8   280   2
> 9   280   2
> 10  260   2
> .......
> 180 450   4
> 181  90   1
> 182 120   1
> 183 440   4
> 184 210   2
> 185 330   3
> 186 210   2
> 187 100   1
> 188   0   0
>
> I want to convert the area column values to factors, to do an anova.
> However, if I use:
>
> df$areaf <- factor(df$area,
> labels=c("0","I","II","III","IV","V","VI","VII"))
>
> it gives the following message:
>
> Error in factor(df$area, labels = c("0", "I", "II", "III", "IV", "V",
> "VI",  :
>         invalid labels; length 8 should be 1 or 7
>
> Can anyone help?
>
> Jabez
>
>
>       ___________________________________________________________
>
> now.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to