Apologies if this has been asked before!
I have a big data set that I need to normalise. The data is in one dataframe, and the value needed for normalisation is in a different one. I've created a small example here:
data = data.frame(AMR = c("cfxA", "23S", "sul2"),
ACLOD_1 = c(347, 323, 186),
ACLOD_11 = c(0, 90, 0),
ACLOD_12 = c(74, 298, 0))
scg = data.frame(gene = "dnaG",
ACLOD_1 = 683,
ACLOD_11 = 789,
ACLOD_12 = 556)
What I need to do is divide the values in "data" by the corresponding value in "scg"; i.e. divide the values in the ACLOD_1 column (347, 323, 186) by 683 so that I get 0.51, 0.47 and 0.27, while the values in ACLOD_11 would be divided by 789, etc.
I've previously managed this by separating out each column of the data and working on it that way, but as I will likely have more than 1,000 columns in total to work on I need to work out a different way - so I was wondering if anyone had any ideas, please?
Many thanks!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…