0

I have a data frame which name is thumb_df. It has headers in every column and counts 3000. I produced needed to log2 and then quantile normalize it. And for that, I assigned the thumb_df to data_mat which is a data matrix then make the 0 cells 1 so they cannot give -inf when I log2 after that I normalized the result and name it data_norm. Right now data_norm has no header so I need to assign it back to thumb_df or put the thumb_df headers to data_norm. How should I do that?

thumb_df 
data_mat <- as.matrix(thumb_df[,-1]) 
data_mat[data_mat == 0] <- 1

data_log2 <- log2(data_mat)
data_norm <- normalize.quantiles(data_log2, copy = TRUE) # quatile 
normalization 

I would be grateful if you can help about that. Thank you.

  • 2
    Please show a small reproducible example – akrun Oct 13 '18 at 20:19
  • 2
    `colnames(data_norm) <- colnames(thumb_df)[-1]`. And if you want or need a dataframe, `data_norm <- as.data.frame(data_norm)`. – Rui Barradas Oct 13 '18 at 20:22
  • this is my thumb_df X X3 X14 X8 .......... 1 12 10 22 15 2 5 1 9 86 this is my data_norm 1 1.22 2.9 8.3 2 2 2 0 5 4 As you can see I do not have the headers in the data_norm – Asker111 Oct 13 '18 at 20:26
  • Rul Barradas I did not know that is the way thx it worked. How do you know those kinds of staff R is way more different than regular software development is there any source I can learn that kind of stuff ??? – Asker111 Oct 13 '18 at 20:28

0 Answers0