Error in match.fun(FUN)

There are several problems with the code.

First, apply operators on a matrix or data.frame. You probably meant to use sapply instead.

Second, nchar() calls nchar without any argument. You want nchar — i.e. the function name, without calling it (the calling will happen inside sapply):

data[, 29] = sapply(data[,29], nchar)

Leave a Comment