[R] data.frame manipulation: Unbinding strings in a row
francogrex
francogrex at mail.com
Thu Jan 10 12:40:38 CET 2008
Hi all,
I have a data.frame I received with data that look like this (comma
separated strings in last row):
ID Shop Items
ID1 A1 item1, item2, item3
ID2 A2 item4, item5
ID3 A1 item1, item3, item4
But I would like to unbind the strings in col(2) items so that it will look
like this:
ID Shop Items
ID1 A1 item1
ID1 A1 item2
ID1 A1 item3
ID2 A2 item4
ID2 A2 item5
ID3 A1 item1
ID3 A1 item3
ID3 A1 item4
Meaning each item is on a different row but still maintain the ties with the
IDs and the Shops.
The final purpose is to count how many times a particular item has been
bought in a particular shop, like:
item1-A1= 2
item2-A1=1
item3-A1=2
Any ideas? Thanks
--
View this message in context: http://www.nabble.com/data.frame-manipulation%3A-Unbinding-strings-in-a-row-tp14731173p14731173.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list