简体   繁体   中英

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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