[R] Odp: Subset Question

Petr PIKAL petr.pikal at precheza.cz
Thu Feb 25 08:10:24 CET 2010


Hi


r-help-bounces at r-project.org napsal dne 25.02.2010 07:37:44:

> 
> Hello helpful R folks,
> 
>    First off, please forgive my English.  Second, I'm new with R, I've
> searched the archives about subsets, and I haven't found quite the help 
I
> need.
> 
> I'm currently analysing a population survey whose data set has about 
15000
> households (the rows/observations) and 130 variables (the columns). I've
> managed to import the set into R as a data.frame called eu08.  Now, I'm
> trying to look at all of the variables, but limited to one province in 
the
> "region" variable.  I think the provinces are factors, and the province 
of
> interest is labeled '3'.
> I've tried the following:
> 
> region3=subset(eu08, region==3)

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?

Regards
Petr


> --this simply strips all of the rows from the columns, and I know that 
about
> 4000 of the observations are specific to region 3.  So does putting the 
3 as
> '3' and "3".
> 
>  Any help would be greatly appreciate.
> 
> -- 
> View this message in context: http://n4.nabble.com/Subset-Question-
> tp1568555p1568555.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