Hi All,
I want to select a level of a factor variable from a dataset. I have the
folowing data:
dataset: use
factor: month (use$month, levels=February, July)
> use[1:5,]
month registration use department size
1 February KKG151GP Y Safety 1.6
To select February I tried:
> use[use$month=="February"]
Error in "[.data.frame"(use, use$month == "February") :
undefined columns selected
> use[use$month == levels(use$month)[1]]
Error in "[.data.frame"(use, use$month == levels(use$month)[1]) :
undefined columns selected
It seems if a logical variable is created, and the subsetting on a factor
variable won't work directly.(It works directly for numeric variables)
Can anyone help please.
Regards
Hennie Gerber
Hennie Gerber
Statistician
UNISA - Research Support
+ 27 12 429 3188
Waarskuwing!
Die sienings uitgespreek is my eie en nie noodwendig my werkgewer sin nie
Warning!
All views expressed are my own and not necessarily that of my employer.
---------------------------------------------------------------------------
This message (and attachments) is subject to restrictions and a disclaimer.
Please refer to http://www.unisa.ac.za/disclaimer for full details.
---------------------------------------------------------------------------
<<<<gwavasig>>>>
<<<< gwavasig >>>>
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html