【发布时间】:2020-09-08 16:06:08
【问题描述】:
有人可以帮我解决这个问题吗?我让 cut_interval 代码为单个测试列工作,但似乎无法让它在 for 循环中工作以使其在所有列上运行。
#Bin worker data into three groups (low/medium/high %methylation) for the cpg cg10757709
#This code works
cg10757709_interval <- cut_interval(cpgs$cg10757709, n=3, labels = c("low","med","high"))
View(cg10757709_interval)
#Write a loop so that data for each of the significant cpgs will be binned into low, medium, and high groups
#This code gives an error (that there are more elements are supplied than there are to replace)
cpgs_interval <- matrix(ncol = length(cpgs), nrow = 29)
for (i in seq_along(cpgs)) {
cpgs_interval[[i]] <- cut_interval(cpgs[[i]], n=3, labels = c("low","med","high"))
}
View(cpgs_interval)
错误显示“cpgs_interval[[i]]
【问题讨论】: