My data frame like this:
> mydata
time id product
1 201301 1 apple
2 201302 1 htc
3 201302 1 apple
4 201302 2 htc
5 201302 2 apple
How get the following result?
> result
time id product
1 201301 1 apple
2 201302 1 apple&htc
3 201302 2 apple&htc
I have tried ddply()
function like this:
ddply(mydata,.(time,id),summarise,paste0(product,"&",product))
But it doesn't work as my expectation.Thanks for your answers.
And, my point is, how to realize in SQL in SAP HANA DATABASE? Thanks a lot!
you can try this:
ddply(tab, .(time, id), summarise, product = paste(product, collapse="&"))
hth