Hi,

How do you subset a dataframe so that you only have columns:

1.       that contain one or more NAs?

2.       that contain factors with greater than or equal to 32 levels?

How do you remove from a dataframe columns**

3.       with one or more NA's?

4.       that contain factors with greater than or equal to 32 levels?

** I know how to remove columns at a basic level but I am trying to figure out 
a more efficient way of performing these particular tasks (my data set has 60 
columns).
For NA's I essentially used summary(mtcars) and manually made a note of where 
NA's appeared than used:
mtcars1<-mtcars1[,!(names(mtcars1)%in% c("hp","wt","vs"))]
I did something similar for factors with greater than x levels only I used 
str(mtcars) to help me identify them.
BTW I know mtcars doesn't have any of these issues. I just used it as a quick 
reference.


Dan


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to