0

I have a dataset where one of the variables (columns) is labeled 'job' with rows having 4 possible values: 'home', 'office', 'other'. For my analyses, I want to ignore 'other'. How could I accomplish this? I found this piece of code, but I am having a hard time understanding what the 'drop' argument means. I would welcome any explanation.

data1 <- data[data$job !="other", , drop=FALSE]; 
data2 <- data[data$job !="other", , drop=TRUE]; 

After trying both, I do unique(data1$job) and unique(data2$job)

And I get in both cases:

[1] home office
Levels: home office other

So it's not clear to me what I have done to the data since the 'other' level is still there.

0 Answers0