【发布时间】:2021-12-30 12:24:21
【问题描述】:
我在 R 中使用命令运行脚本:Rscript gtex_tiss_chrom.R 1 这个脚本的内容是:
source("../code/gtex_v7_nested_cv_elnet.R")
"%&%" <- function(a,b) paste(a,b, sep='')
argv <- commandArgs(trailingOnly = TRUE)
chrom <- argv[1]
#tiss <- argv[1]
#chrom <- argv[2]
snp_annot_file <- "../output/snp_annot.chr" %&% chrom %&% ".txt"
gene_annot_file <- "../output/gene_annot.parsed.txt"
genotype_file <- "../output/genotype.chr" %&% chrom %&% ".txt"
expression_file <- "../output/transformed_expression.txt"
covariates_file <- "../output/covariates.txt"
prefix <- "Model_training"
main(snp_annot_file, gene_annot_file, genotype_file, expression_file, covariates_file, as.numeric(chrom), prefix, null_testing=FALSE)
错误: 文件中的错误(文件,“rt”):无法打开连接 调用:main ... get_filtered_snp_annot -> %>% -> distinct -> filter -> read.table -> file 另外:警告信息: 在文件(文件,“rt”)中: 无法打开文件“snp_annot.chrNA.txt”:没有这样的文件或目录 执行停止
【问题讨论】:
-
阅读。
cannot open file 'snp_annot.chrNA.txt': No such file or directory Execution halted -
是的,但是我传递的参数 1 对应于 snp_annot.chr1.txt
-
嗯,所以你的行
snp_annot_file <- "../output/snp_annot.chr" %&% chrom %&% ".txt"应该导致:./output/snp_annot.chrsnp_annot.chr1.txt.txt"?您将 chrom 粘贴到文件名,因此您的参数不应该是文件。 ? -
应该是 snp_annot.chr1.txt 而不是 snp_annot.chrsnp_annot.chr1.txt.txt
-
好的,试试
snp_annot_file <- chrom。您正在尝试构建一个您似乎不想要的文件名。
标签: r compiler-errors syntax-error rscript