I've written this function which just replaced each value in a data table's column with its substring:
substrColName <- function(df, colName, start) { df %>% mutate(colName = substr(colName, start=start, stop=nchar(colName))) } But every time I try running it I get the error:
Error in as.character(x) : cannot coerce type 'closure' to vector of type 'character' Now I've done a lot of research on why it won't work but I can't figure it out. I've read on some stuff with standard evaluations and lazyeval but nothing I try seems to work. Any help?
Thanks