[R] What does 'collapse' mean in apply()?

David Winsemius dwinsemius at comcast.net
Wed Sep 16 23:19:12 CEST 2009


On Sep 16, 2009, at 5:15 PM, Peng Yu wrote:
>
> I can't find 'collapse' in the help of apply. Can somebody let me know
> where its document is? What is 'collapse' for?
>
>> x=matrix(1:6,nr=2)
>> apply(x,1,paste,collapse=',')
> [1] "1,3,5" "2,4,6"
>

collapse is a parameter to paste.

apply accepts ... arguments which it passes along to function it calls.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list