Dear list, Say I have a data frame with NA in the variable which I want to use as a sorting variable for splitting the data frame.
df <- data.frame(A=1:10, B=c(rep(99,5), rep(100,5)), C=c(rep(NA,3), rep(1,3), rep(2,4))) split(df, f=df[c('C')], drop=FALSE), I got the output as follows. I was hoping to retain the part of the df where C=NA. drop=FALSE doesn't seem to take effect here. Appreciate any comments. Thanks. $`1` A B C 4 4 99 1 5 5 99 1 6 6 100 1 $`2` A B C 7 7 100 2 8 8 100 2 9 9 100 2 10 10 100 2 Jun [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.