Re: [R] how to subset unique factor combinations from a data frame.

2011-01-05 Thread Petr PIKAL
m: Dennis Murphy [mailto:djmu...@gmail.com] > Sent: Tuesday, January 04, 2011 9:07 PM > To: SNV Krishna > Cc: r-help@r-project.org > Subject: Re: [R] how to subset unique factor combinations from a data frame. > > > Hi: > > Did you try something like > > summdf <-

Re: [R] how to subset unique factor combinations from a data frame.

2011-01-04 Thread SNV Krishna
Hi Dennis, It worked! this is what I am looking for. Many thanks. Rgds, SNVK _ From: Dennis Murphy [mailto:djmu...@gmail.com] Sent: Tuesday, January 04, 2011 9:07 PM To: SNV Krishna Cc: r-help@r-project.org Subject: Re: [R] how to subset unique factor combinations from a data

Re: [R] how to subset unique factor combinations from a data frame.

2011-01-04 Thread Dennis Murphy
Hi: Did you try something like summdf <- as.data.frame(with(df, table(Commodity, Attribute, Unit))) ? The rows of the table should represent the unique combinations of the three variables Here's a simple toy example to illustrate: > x <- sample(LETTERS[1:6], 1000, replace = TRUE) > xx <- sa

Re: [R] how to subset unique factor combinations from a data frame.

2011-01-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.01.2011 11:19:02: > Hi, > > Sorry that my example is not clear. I will give an example of what each > variable holds. I hope this clearly explains the case. > > Names of the dataframe (df) and description > > Year :- Year is calendar year, from 198

Re: [R] how to subset unique factor combinations from a data frame.

2011-01-04 Thread SNV Krishna
Hi, Sorry that my example is not clear. I will give an example of what each variable holds. I hope this clearly explains the case. Names of the dataframe (df) and description Year :- Year is calendar year, from 1980 to 2010 Country :- is the country name, total no. (levels) of countries is ~ 19