【发布时间】:2020-05-06 01:49:53
【问题描述】:
我对 R 中数据框中的值转换有疑问。我的计算数据由 (0 到 0.999) 和 (1 到无穷大) 范围内的值组成。我想保留表中的(1 到无穷大)值,但是,为了使用公式 (-1/[(0 to 0.999)]) 绘制热图,我想将(0 到 0.999)转换为负值。下面是我的输入和输出数据的示例。请帮我解决这个问题。
Input_Data <- read.csv(file = "./Synthetic_Data_Input.csv",stringsAsFactors = FALSE, row.names = 1)
Output_Data <- read.csv(file = "./Synthetic_Data_Output.csv",stringsAsFactors = FALSE, row.names = 1)
dput(Input_Data)
structure(list(Sample_1 = c(0.942972, 1.00812, 1.10038, 1.19572,
1.28194, 1.37384, 1.75378, 2.56584, 2.56584), Sample_3 = c(0.517607,
0.935699, 0.567427, 0.572821, 0.795282, 0.541105, 1.03596, 2.78013,
0.189337)), class = "data.frame", row.names = c("Gene_4", "Gene_7",
"Gene_2", "Gene_3", "Gene_6", "Gene_9", "Gene_5", "Gene_8", "Gene_1"
))
dput(Output_Data)
structure(list(Sample_1 = c(-1.060476875, 1.00812, 1.10038, 1.19572,
1.28194, 1.37384, 1.75378, 2.56584, 2.56584), Sample_3 = c(-1.93196769,
-1.068719749, -1.762341235, -1.745746053, -1.257415609, -1.848070153,
1.03596, 2.78013, -5.281587857)), class = "data.frame", row.names = c("Gene_4",
"Gene_7", "Gene_2", "Gene_3", "Gene_6", "Gene_9", "Gene_5", "Gene_8",
"Gene_1"))
谢谢, 图菲克
【问题讨论】:
标签: r dataframe data-conversion