How to cut a character string into multiple pieces in the R programming language. More details: https://statisticsglobe.com/split-cha...
R code of this video:
my_string <- "AAABBBCCC" # Create example character string
my_string # Print example character string
n <- 2 # Define length of character chunks
substring(my_string, # Apply substring function
seq(1, nchar(my_string), n),
seq(n, nchar(my_string), n))
strsplit(gsub(paste0("([[:alnum:]]{", # Apply strsplit function
n,
"})"),
"\\1 ",
my_string),
" ")[[1]]
Follow me on Social Media:
Facebook – Statistics Globe Page: / statisticsglobecom
Facebook – Group for Discussions & Questions: / statisticsglobe
LinkedIn – Statistics Globe Page: / statisticsglobe
LinkedIn – Group for Discussions & Questions: / 12555223
Twitter: / joachimschork
Music by bensound.com
On this page of the site you can watch the video online Split Character String into Chunks in R (2 Examples) | Cut, Divide & Chop | substring() & strsplit() with a duration of hours minute second in good quality, which was uploaded by the user Statistics Globe 20 November 2021, share the link with friends and acquaintances, this video has already been watched 1,015 times on youtube and it was liked by 20 viewers. Enjoy your viewing!