I have a data frame with cell ID in row names and classification in column x.
x
ACCTTAC do
ACCGTGG si
AGTCGGG si
I also have a matrix with cell IDs in columns and genes in rows.
ACCTTAC ACCGTGG AGTCGGG
Gene1 4 5 1
Gene2 3 1 0
Gene3 3 3 1
I would like to paste in colnames of the Matrix classification coming from the data frame, see an example below.
do_ACCTTAC si_ACCGTGG si_AGTCGGG
Gene1 4 5 1
Gene2 3 1 0
Gene3 3 3 1
dput(df)
structure(list(x = c("do", "si", "si"), row.names = c("ACCTTAC", "ACCGTGG", "AGTCGGG"), class = "data.frame"))
mat = matrix(c(8,4,5,6,7,9,1,8,9),nrow = 3, ncol = 3,byrow = TRUE)
mat <- matrix(1:9, nrow = 3,dimnames = list(c("Gene1","Gene2","Gene3"), c("ACCTTAC","ACCGTGG","AGTCGGG")))
dataframe <- data.frame(...
, that way we can help you better. – Manu