although it is a more general R question, if you do not mind having me asking the question on BioC list, as it relates to the packages maftools and ComplexHeatmap.
I would appreciate please a piece of help regarding the use of acast/dcast functions in reshape2 package (the output matrix will serve as input into maftools and ComplexHeatmap).
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,