Re: [R] Odp: having problems with factor()

2007-08-10 Thread Jabez Wilson
You've spotted it!

table(df$area)
 0  1  2  3  4  5  7 
21 27 71 46 19  3  1 
 
There are no values in area 6.

Thank you very much.

Jabez


- Original Message 
From: Petr PIKAL [EMAIL PROTECTED]
To: Jabez Wilson [EMAIL PROTECTED]
Cc: R-Help r-help@stat.math.ethz.ch
Sent: Friday, 10 August, 2007 1:02:21 PM
Subject: Odp: [R] having problems with factor()


Hi
[EMAIL PROTECTED] napsal dne 10.08.2007 13:41:53:

 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).
 
 htarea
 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:
 

Hm, maybe some of the values are missing

 num-sample(1:3, 10, replace=T)
 num
[1] 1 3 1 2 3 3 1 3 3 3
 factor(num, labels=c(O, I, II))
[1] O  II O  I  II II O  II II II
Levels: O I II

 factor(num, labels=c(O, I, II, III))
Error in factor(num, labels = c(O, I, II, III)) : 
invalid labels; length 4 should be 1 or 3


try

table(df$area)
to see what level you really have

Regards
Petr


 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.


  ___

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.


[R] Odp: having problems with factor()

2007-08-10 Thread Petr PIKAL
Hi
[EMAIL PROTECTED] napsal dne 10.08.2007 13:41:53:

 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).
 
 htarea
 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:
 

Hm, maybe some of the values are missing

 num-sample(1:3, 10, replace=T)
 num
 [1] 1 3 1 2 3 3 1 3 3 3
 factor(num, labels=c(O, I, II))
 [1] O  II O  I  II II O  II II II
Levels: O I II

 factor(num, labels=c(O, I, II, III))
Error in factor(num, labels = c(O, I, II, III)) : 
invalid labels; length 4 should be 1 or 3


try

table(df$area)
to see what level you really have

Regards
Petr


 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.

__
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.