separating characters in a dataframe

Hi,
I want to separate a column in a DataFrame into two new columns.

For example:

x <- data.frame("letters" = c('aa','sd','vc'))

to:

x <- data.frame("letters_a" = c('a','s','v'), "letters_b" = c('a','d','c'))

Cheers,

Ziv

this work on your example

tidyr::separate(data = x,
                col="letters",
                into=c("letters_a",
                       "letters_b"),
                sep=1)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Great! exactly what I needed