将ID的所有条目存储在列表中的列表中
因此,假设我有一些简单的数据如下:
ID value character
001 A JABA
002 B FABA
001 B RABA
003 D RIBI
003 TT LENI
004 A LENT
001 A TATA
004 N YAYA
004 N YANA
我想做的(使用tidyverse/dplyr)是在整个表中创建这些ID及其值的汇总表。如果用户具有值的重复,则只能出现一次。
预期输出
ID values
001 [A,B]
002 [B]
003 [D,TT]
004 [A,N]
不过分依附于格式,但您会得到这个想法:)
So let's say I have some simple data as follows:
ID value character
001 A JABA
002 B FABA
001 B RABA
003 D RIBI
003 TT LENI
004 A LENT
001 A TATA
004 N YAYA
004 N YANA
And what I want to do (using tidyverse/dplyr) is to create a summarized table of these IDs and their values across the entire table. If the user has duplicates of a value, it should only appear once.
Expected Output
ID values
001 [A,B]
002 [B]
003 [D,TT]
004 [A,N]
Not overly attached to format but you get the idea :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不需要串联的字符串,而是独特值的向量
if you don't need a concateneted string but a vector of unique values