I am trying to extract the first few characters from a column in a data frame. What I need is first few character till a "," is encountered.
Data:
texts
12/5/15, 11:49 - thanks, take care
12/5/15, 11:51 - cool
What I need is
texts date
12/5/15, 11:49 - thanks, take care 12/5/15
12/10/15, 11:51 - cool 12/10/15
I tired using this, but this returned everything without the columns
df$date <- sub(", ", "", df$date, fixed = TRUE)
and
df$date <- gsub( ".,","", df$texts)
Excel equivalent
=LEFT(A1, FIND(",",A1,1)-1)