0
cerveceria_dataset$CLIENTE <- separate(cerveceria_dataset$CLIENTE, col = CLIENTE, into =  c("Nombre","Apellido"), sep = ";")

This code give me the

"Error in UseMethod("separate") : no applicable method for 'separate' applied to an object of class "character""enter image description here

NelsonGon
  • 13,015
  • 7
  • 27
  • 57

2 Answers2

1

I think you are applying the function wrong. Try using -

cerveceria_dataset <- tidyr::separate(cerveceria_dataset, 
                       col = CLIENTE, into =  c("Nombre","Apellido"), sep = ";")
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
0

tidyr::separate splits a string column into multiple columns. If you are just working with a single character vector, you probably want something like stringr::split, which splits a character vector into a list of vectors (or a matrix if you use str_split_fixed).

Migwell
  • 18,631
  • 21
  • 91
  • 160
  • i tried to do: " cerveceria_dataset$CLIENTE <- split(cerveceria_dataset$CLIENTE, c("Nombre","Apellido"), ";") " b – Kevin CZ Nov 12 '21 at 14:09
  • but it just separate the data in the same colum, i want to get two colums by the colum CLIENTE – Kevin CZ Nov 12 '21 at 14:10
  • xD but i mean, i want splits a string column into multiple columns, i dont understand why when i use separate give me this error – Kevin CZ Nov 12 '21 at 14:13