[R] Odp: Subset Question

Petr PIKAL petr.pikal at precheza.cz
Thu Feb 25 11:28:13 CET 2010


Hi

r-help-bounces at r-project.org napsal dne 25.02.2010 08:22:48:

> 
> <<This shall work. What really are values of region? What does 
> str(eu08$region) tell you about it? If it is really factor, what are 
> really its levels? What does level(eu08$region) show?>>
> 
> My thoughts were also that it would work, but it results in 130 column
> headings stripped of all rows.
> To answer your questions:
> str(eu08$region) yielded:
> $ region  : Factor w/ 10 levels "1.Byrard",..: 3 3 3 3 10 10 10 4 4 4 
...
> 
> level(eu08$region) yielded nothing, but levels(eu08$region) yielded:
> [1] "1.Byrard"    "2.Alsat"   "3.Bigur" 
>  [4] "4.Itziar"    "5.Ingur"   "6.Git" 
>  [7] "7.Git Balance"   "8.Triage"     "9.Snolunt"
> [10] "10.Bigntu"

Here is your problem. Factor is integer numeric vector with label for each 
separate level of factor.  If you want question your factor you need to 
use proper label.

see
subset(eu08, region=="1.Byrard")

Regards
Petr


> 
> Thanks for your attention, Petr!
> -- 
> View this message in context: http://n4.nabble.com/Subset-Question-
> tp1568555p1568584.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org 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.



More information about the R-help mailing list