How to find the length of a string in R

后端 未结 6 1556
遥遥无期
遥遥无期 2020-12-04 05:49

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 wha

6条回答
  •  一整个雨季
    2020-12-04 06:10

    nchar(YOURSTRING)
    

    you may need to convert to a character vector first;

    nchar(as.character(YOURSTRING))
    

提交回复
热议问题