Rolf Turner <r.turner <at> auckland.ac.nz> writes: [snip] > > But I think that the best approach would be to include a warning in > the documentation of subset, to the effect: ``There are subtle and > difficult issues involved in the use of this function. If you don't > understand them, don't mess with it.''
options(enable.expert.use=TRUE) ? (We could couple this with a "tainting" mechanism like that for proprietary modules in the Linux kernel -- in our case it would disallow posting on the topic to r-help ...) > Others have pointed out in this thread that one does not *have* to use > subset() --- anything it can do can be done in other ways. Like those > who pointed this out, I myself have never used subset(), never felt I > had to, and never felt any the worse for not having done so. I have been encouraging my students to use subset() because in many cases it lets them work on a higher level of abstraction -- "I want to select the following variables/cases" rather than "I want to do logical indexing on this data frame". Sooner or later one has to get down to the lower level of abstraction, but it's nice to be able to work at the higher level when one doesn't *need* to get all dirty and worry about the details ... it's like the difference between sqrt(outer(data$x,data$x,"-")^2+outer(data$y,data$y,"-")^2) and as.matrix(dist(data)) Sometime soon when I have the time and energy I will start campaigning for an additional "drop" argument to subset that does what one expects (!!??) with subsetted factor variables ... cheers Ben Bolker ______________________________________________ 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.