无法分隔数据框中的名称

问题描述 投票:0回答:1

我在分隔数据框中的名称时遇到问题。有人可以帮我吗?

这是数据框代码。

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)

我想把学生栏里的名字分开

enter image description here

r plyr
1个回答
0
投票

非常感谢大家。我使用了这段代码,问题已经解决。

separate(data = Class.perf, col = Students, into = c("First.name", "Second.name"))

-OP

您也可以使用

separate_wider_*()
检查文档。

© www.soinside.com 2019 - 2024. All rights reserved.