Changing length(STRING_ELT to CHARLEN(STRING_ELT