Dear all, I would appreciate please a piece of help regarding the use of acast/dcast functions in reshape2 package.
Specifically, I'm working with a data frame, that has information about SAMPLE, GENE, and TYPE of MUTATION (as shown below): Sample Gene Type 22M AEBP1 SNV 17M AEBP1 SNV 22M ATR INDEL 22M ATR SNV 11M BTK SNV 11M BTK INDEL I would like to transform this DATAFRAME into a MATRIX that has GENE on ROWS, SAMPLE on COLUMNS, and the elements of the matrix are SNV or INDEL (ie the types of mutations). The R code starts with : y <- data.frame(Sample = x$Sample, Gene = x$Gene, Type=x$Type) z <- acast(y, Cancer_Gene ~ Sample) although in z, I do not have the information on Type (i.e.SNV or INDEL). thanks a lot, -- bogdan [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.