我想缩放我的dataframe protein
,使值在0和1之间。
protein <- (protein - min(protein)) / (max(protein) - min(protein))
追溯:
Error in FUN(X[[i]], ...) :
only defined on a data frame with all numeric-alike variables
我尝试了unlist
,但错误仍然存在。
> typeof(protein)
[1] "list"
数据:
> dput(protein)
structure(list(TCGA.A3.3357.01 = c("0.43216667125", "0.27655395325",
"-0.05052052725"), TCGA.A3.3367.01 = c("0.22529132975", "-0.12950190925",
"0.00483883425000009"), TCGA.A3.3387.01 = c("0.0428932150000005",
"0.0548635820000001", "0.0339660955000001")), row.names = c("14-3-3_beta",
"14-3-3_epsilon", "14-3-3_zeta"), class = "data.frame")
2条答案
按热度按时间mdfafbf11#
将列转换为
numeric
并使用apply
数据
polhcujo2#
使用{dplyr}的方法:
edit正如Julien所指出的,
across
-mutate
都可以集总: