0

I am having trouble separating the names in a data frame. Can anyone help me with that?

Here is the data frame code.

Classe1 <- c("class1", "class2", "class3","class1", "class2", "class3","class1", "class2", "class3")
Marks.class <- c(12,14,54,67,87,8,17,11,20)
Students <- c("Thom Eric", "Sandra Leaf", "Fanta derrick", "Nike Gael", "Dan JD","Thom Eric","Sandra Leaf", "Sandra Leaf","Sandra Leaf")
Class.perf <- data.frame(Classe1,Marks.class,Students)

And I Want to separate the names in the students's column.

enter image description here

Andre Wildberg
  • 12,344
  • 3
  • 12
  • 29
Thacien
  • 5
  • 1
  • 1
    This should be of help: https://stackoverflow.com/questions/7069076/split-column-at-delimiter-in-data-frame – novica Feb 27 '23 at 13:27
  • You're having trouble, what did you do that is not working? – r2evans Feb 27 '23 at 13:35
  • Thank you so much, All. I used this code and the problem has been solved. separate(data = Class.perf, col = Students, into = c("First.name", "Second.name")) – Thacien Feb 27 '23 at 13:56

1 Answers1

0

Thank you so much, All. I used this code and the problem has been solved. separate(data = Class.perf, col = Students, into = c("First.name", "Second.name"))

-OP

You could also use separate_wider_*(). Check the documentation.

Mark
  • 7,785
  • 2
  • 14
  • 34