subset states
For programming it is better to use the standard subsetting functions like
[, and in particular the non-standard evaluation of argument subset can have unanticipated consequences.
To me it is not clear, how this can lead to errors after reading Advanced R - Non-standard evaluation in subset. Assume I have the following code snippet:
myfun <- function(...) {
...
df <- data.frame(col1 = c("a", "b", NA), col2 = 1:3, col3 = 11:13)
df_s <- subset(x = df, subset = col1=="a", select = c(col1, col2))
# In the following I only use df_s in some way
return(...)
}
To me, this looks save to use in scripts / functions?
Minor issue: Can I include row.names(df_s) <- NULL in subset using ...? I could figure that out...