Hi All
 
I have these questions and request members expert view on this. 
 
a) I have a dataframe (df) with five factors (identity variables) and value
(measured value). The id variables are Year, Country, Commodity, Attribute,
Unit. Value is a value for each combination of this.
 
I would like to get just the unique combination of Commodity, Attribute and
Unit. I just need the unique factor combination into a dataframe or a table.
I know aggregate and subset but dont how to use them in this context. 
 
b) Is it possible to inclue non- aggregate columns with aggregate function
 
say in the above case > aggregate(Value ~ Commodity + Attribute, data = df,
FUN = count). The use of count(Value) is just a round about to return the
combinations of Commodity & Attribute, and I would like to include 'Unit'
column in the returned data frame?
 
c) Is it possible to subset based on unique combination, some thing like
this.
 
> subset(df, unique(Commodity), select = c(Commodity, Attribute, Unit)). I
know this is not correct as it returns an error 'subset needs a logical
evaluation'. Trying various ways to accomplish the task. 
 
will be grateful for any ideas and help 
 
Regards,
 
SNVK 

	[[alternative HTML version deleted]]

