Re: [R] Subsetting Data from a Dataframe

2019-05-24 Thread Rui Barradas
Hello, Maybe something like the following is what you want. The code first creates a logical index of columns with at least one NA or "NULL" (character string, not NULL) values. Then extracts only those columns from the dataframe. inx <- sapply(datos, function(x) any(x == "NULL" | is.na(x)))

Re: [R] Subsetting Data from a Dataframe

2019-05-24 Thread Sarah Goslee
Hi Paul, Thanks for the reproducible data. You really only need to provide enough to illustrate your question, but this works. I suspect you have a data import problem - I doubt you really want so many columns to be factors! Probably you need to specify that NULL means something specific, rather

[R] Subsetting Data from a Dataframe

2019-05-24 Thread Paul Bernal
Dear friends, Hope you are all doing well. I would like to know how to retrieve a complete dataframe (all the columns), except for the cases when one of the columns have either nulls or NAs. In this case, I´d like to retrieve all the columns but only the cases (rows) where Var5 has values differe