Extract First Entry from Character String Split (2 Examples) | Get, Select & Return | strsplit & sub

Опубликовано: 10 Февраль 2025
на канале: Statistics Globe
153
8

How to get the first part of a character string in the R programming language. More details: https://statisticsglobe.com/extract-f...
R code of this video:

my_string <- "This is a character string" # Create example character string
my_string # Print example character string

strsplit(my_string, " ")[[1]][1] # Extract first element

sub(" .*", "", my_string) # Extract first element

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