大家早上好。
我有一个很大的数据帧,特别是我有一个包含5到15个元素的列(一个列表)。我想把它分成多列,每列的元素有多少。
A B JHON
GREEN c("abc", "def", "ghi") yellow
RED c("123", "456", "789") blue
JACK d("rgy", "bob", "pbc") pink我想要实现这样的事情
A B C D JHON
GREEN abc def ghi yellow
RED 123 456 789 blue
JACK rgy bob pbc pink
ah <- c("A", "B", "C")
separate(df , unlist(df$B), ah )我试图设置一个这样的东西,但是我得到了下面的错误
Errore: Must extract column with a single valid subscript.
x Subscript `var` has size 5322 but must be size 1.提前感谢所有能帮助我的人。我添加了我感兴趣的列
ProductGallery = list(
c("http://images.icecat.biz/img/gallery/15656565_3828389912.jpg",
"http://images.icecat.biz/img/gallery/15656565_0985217712.jpg",
"http://images.icecat.biz/img/gallery/15656565_2053118492.jpg",
"http://images.icecat.biz/img/gallery/15656565_3136121979.jpg",
"http://images.icecat.biz/img/gallery/15656565_3698859043.jpg",
"http://images.icecat.biz/img/gallery/15656565_7403185164.jpg",
"http://images.icecat.biz/img/gallery/15656565_5829735672.jpg",
"http://images.icecat.biz/img/gallery/15656565_1378074619.jpg",
"http://images.icecat.biz/img/gallery/15656565_9686454727.jpg",发布于 2021-06-15 17:45:06
尝试以下操作:
df$C <- df$B[2]
df$D <- df$B[3]
df$B <- df$B[1]https://stackoverflow.com/questions/67983589
复制相似问题