Remove all rows where length of string is more than n

Solution 1:

To reword your question slightly, you want to retain rows where entries in f_name have length of 3 or less. So how about:

subset(m, nchar(as.character(f_name)) <= 3)

Solution 2:

Try this:

m[!nchar(as.character(m$f_name)) > 3, ]