【发布时间】:2023-04-04 15:03:02
【问题描述】:
它们都以“rsid_set(variable)”开头。我几乎没有编码经验,但一直在尝试使用 R 和 python。有什么快速的方法可以获得我想要的那些列吗?
跟进:有没有办法把每一列的均值转化为10000个值的正态分布?
【问题讨论】:
它们都以“rsid_set(variable)”开头。我几乎没有编码经验,但一直在尝试使用 R 和 python。有什么快速的方法可以获得我想要的那些列吗?
跟进:有没有办法把每一列的均值转化为10000个值的正态分布?
【问题讨论】:
# read in
df <- read.tsv("path/to/your/file")
# select only colnames beginning with rsid_set
df <- df[grep("^rsid_set",colnames(df)),]
Your follow-up, I don't understand. You'll have to clarify what you want.
# Take the means of each column:
means <- colMeans(df)
# normal distribution with 10k values
norms <- rnorm(10e3)
【讨论】:
read.csv IS read.table 具有不同的功能默认值,即:sep=","
$,结束。您可以在?regex 中找到所有可用正则表达式的描述。