I have a dataframe with a bunch of columns. I'd like to drop one of the columns named age..
type.name <- "age"
so I tried
df <- subset(df, select = -type.name)
but it throws the error: invalid argument to unary operator.
However, this does work
df <- subset(df, select = -age)
How do I do get it to work dynamically with the variable?
Best Answer
It works with
and
and