I would like to write functions for my very long code. Unfortunately I cant include variables into my functions.
Example:
class.function <- function(var2){
df$var2 <- as.numeric(df$var2)
}
My problem is. The as.numeric function sees "var2" as a part of the dataframe and not as my variable which should be assigned by my function.
I tried it with different combinations of [],() and "", but it was more trying than knowing.