Re: [R] reshaping the data

2017-07-03 Thread Bogdan Tanasa
Thanks a lot gentlemen, and particularly Petr -- the R code you did share helped tremendously ;) On Mon, Jul 3, 2017 at 2:53 AM, PIKAL Petr wrote: > Hi > > Do you want something like > > dcast(test, Sample~Gene, fun=function(x) paste(x, collapse=",")) > > or > > dcast(test, Sample~Gene, fun=func

Re: [R] reshaping the data

2017-07-03 Thread PIKAL Petr
Hi Do you want something like dcast(test, Sample~Gene, fun=function(x) paste(x, collapse=",")) or dcast(test, Sample~Gene, fun=function(x) sum(as.numeric(x))) 1 means INDEL, 2 means SNV and three means both Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-pro

Re: [R] reshaping the data

2017-07-03 Thread Jim Lemon
Hi Bogdan, If you want something like this: 22M 17M 11M AEBP1 SNV SNV NA ATR INDEL NA NA ATR SNV NANA BTKNA NA SNV BTK NA NA INDEL You're in trouble with repeated row names. Same with column names i