How to Get the Length of a Character String in R (Example Code)
This tutorial explains how to find the amount of characters in a string in R.
Construction of Example Data
x <- "slfghdslkgnjkdsngjdf" # Create a random character string |
x <- "slfghdslkgnjkdsngjdf" # Create a random character string
Example: Apply nchar Function to Get Number of Characters in String
nchar(x) # Return length of string # 20 |
nchar(x) # Return length of string # 20
Related Articles
Please have a look at the following R programming tutorials. They focus on similar topics as this page: