Hi, R function aggregate can only take summary stats functions, can I
aggregate text columns?  For example, for the dataframe below, 

 

> a <- rbind(data.frame(id=1, name='Tom',
hobby='fishing'),data.frame(id=1, name='Tom',
hobby='reading'),data.frame(id=2, name='Mary',
hobby='reading'),data.frame(id=3, name='John',
hobby='boating'),data.frame(id=2, name='Mary', hobby='running'))

> a

  id name   hobby

1  1  Tom fishing

2  1  Tom reading

3  2 Mary reading

4  3 John boating

5  2 Mary running

 

 

I want output as 

>b

id name hobbies

1 Tom    fishing reading

2 Mary reading running

3 John boating

 

 

 

Thanks,

Richard

 


	[[alternative HTML version deleted]]

