I found this question which was helpful in subsetting a DF for numeric columns only.
Selecting only numeric columns from a data frame
However I can't figure out how to do numeric columns PLUS any other columns.
I've tried:
nums <- sapply(df, is.numeric)
df <- df[, c(nums, "charcolumn")]
and:
df <- df[,c(sapply(df, is.numeric), "Pop_Size_Group")]
both of which gave me an "undefined columns selected error"
I understand that the sapply function gives me a list of TRUE/FALSE. How can I subset my df to include all numeric columns PLUS additional columns I identify?