简体   繁体   English

R:过滤列并使用结果创建新表

[英]R: filtering columns and creating a new table with the outcome

I am unfortunately a beginner and would like to ask if any of you have an idea to solve my problem.不幸的是,我是初学者,想问一下你们是否有解决我问题的想法。 It is about a table with club members with the following columns: Name, Address, Postcode, City.它是关于一个包含以下列的俱乐部成员的表格:姓名、地址、邮政编码、城市。 Some of these members are married or live at the same address for other reasons.其中一些成员已婚或因其他原因住在同一地址。 I need to send invitations and those who live at the same address should receive only one common invitation.我需要发送邀请,住在同一地址的人应该只收到一份普通邀请。 I need commands that create a table with the same columns again, but with the names with the same address in a common cell.我需要再次创建具有相同列的表的命令,但名称在公共单元格中具有相同的地址。 Is something like this possible?这样的事情可能吗? See the picture below for better understanding.请参阅下图以更好地理解。

Thank you very much for your help!非常感谢您的帮助!

Picture: from how it is now to how it should look like afterwards图片:从现在的样子到以后的样子

Aggregate with the paste function, roughly:用浆糊function聚合,大致:

aggregate(df$name, by=list(df$address), FUN=paste)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM