On Mar 18, 2012, at 3:07 PM, mail me wrote:

Hi:
Thanks for reply. I am using the following statement

res <- with(df, table(paste(item1, item2, sep=', ')) )

to get the frequency counts of the rows, which gives the following output:
milk,bread 2
bread,butter 1
beer,diaper 3
milk,bread 2


You have already been asked why we readers should think that 'milk,bread' has two different entries. Until that is resolved there is not a firm basis for offering further assistance.

But I need to extract from the above result two vectors or dataframes
(such as DF1 and DF2) to make the final output as below:

DF1
milk,bread
bread,butter
beer,diaper
milk,bread

DF2
2
1
3
2

Nonetheless, if you want to ignore the obvious problems in your data feel free to use this:

DF1 <- data.frame(V1 = res[ , 1])
DF2 <- data.frame(V1 = res[ , 2])

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to