I have an issue about separation of one column into multiple columns.
The string example I want to separate is something like '87 BestMovie.GOOD'
separate locations are space ' '
and '.'
I tried like this
df=data.frame(Eastwood=c('87 BestMovie.GOOD'))
sep=df%>%
separate(Eastwood,into=c('age','Select','Movie'),sep=c(' ','.'))
Warning messages: 1: Too many values at 1 locations: 2 2: Too few values at 1 locations: 1
or for another perspective, can we implement string locations for separation?
Thanks!
"sep" needs to be a single character value representing a regular expression. Do this:
df %>% separate(Eastwood,into=c('age','Select','Movie'),sep=" |\\\\.")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With