Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

extract first element before a character stringr

library(stringr)

df1 <- read.table(text = "ABC|DEF|GHI, ABCD|EFG|HIJK,  ABCDE|FGHI|JKL,  
                         DEF|GHIJ|KLM, GHI|JKLM|NO|PQRS, BCDE|FGHI|JKL")
#extract 1st word before |
word(df1$V1,1,sep = "|")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #extract #element #character #stringr
ADD COMMENT
Topic
Name
4+1 =