I am using ddply
right now. It's very easy to deal with numbers. Such as take the mean or standard deviation of the subgroup.
But I have difficulty dealing with strings. I would like to combine the strings in the same column in each subgroup, but I could not do it. I tried cbind
paste
, etc. Anyone can offer some help?
Add collapse=""
to your paste statement
ddply(mtcars, .(carb), summarize, cyl_concatenated = paste(cyl, collapse = ""))
# carb cyl_concatenated
#1 1 4664444
#2 2 8444888444
#3 3 888
#4 4 6686688888
#5 6 6
#6 8 8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With