how to break 1 column in 2 colums

how i can break 1 colum in 2 eg
33.54+72.97 is in 1 colum and i want to break it in 2 colums eg 33.54 and 72.97

It looks like you want to use the {dplyr} function, separate()

my_data %>%
  separate(my_column, into = c("first_col", "second_col"),
                  sep = " + " )
1 Like

its not working please help
separate("x", into = c("LAT", "LONG"),
sep = " + " )

did you get an error ?
it would be rational to quote the error you receive... but in this case I can predict what it would be.

it could be that you havent loaded the assumed tidyverse library , which includes the tidyr library of which separate is a function.

even then, tidyr::separate does not process raw character strings, it processes dataframes with character columns.

Here is a complete example


(x <- c("33.54+72.97","33.56+72.91"))

(my_x_df <- enframe(x))

         into = c("LAT", "LONG"),
         sep = "\\+" )
1 Like

This topic was automatically closed 21 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.