0 votes
1 view
in R Programming by (7.3k points)

How to find the length of a string (number of characters in a string) without splitting it in R? I know how to find the length of a list but not of a string.

And what about Unicode strings? How do I find the length (in bytes) and the number of characters (runes, symbols) in a Unicode string?

1 Answer

0 votes
by (25.4k points)

To find the length of a string in R, you can use the nchar() function as follows:



[1] 6

To find the length of multiple strings and exclude NA’s, you can use the stri_length() function from the stringi package as follows:



[1]  6  5 NA

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !