[R] undefined columns selected

Ana Marija @okov|c@@n@m@r|j@ @end|ng |rom gm@||@com
Tue Dec 3 23:38:04 CET 2019


Hello,

I am trying to run this software:

https://github.com/eleporcu/TWMR

and I have my input files in my current directory: ENSG00000154803.matrix,
ENSG00000154803.ld

but when I try to run it:

Rscript MR.R ENSG00000154803

[1] "ENSG00000154803"
Error in `[.data.frame`(C, , 1:length(C[, 1])) :
  undefined columns selected
Calls: as.matrix -> [ -> [.data.frame
Execution halted

I should mention that I was able to run this script before with the same
command when I had input like:
https://github.com/eleporcu/TWMR/blob/master/ENSG00000000971.matrix

and I also, per suggestion changed the beginning of the code to be:
cmd_args <- commandArgs(TRUE)
if (length(cmd_args) == 0L) stop("No arguments specified.")
print(cmd_args)
gene<-cmd_args[length(cmd_args)]   ## Last argument is the 'gene'
Ngwas<-239087
N_eQTLs<-32000
out<-c("gene","alpha","SE","P","Nsnps","Ngene")

file<-paste(gene,"matrix",sep=".")
if (!file.exists(file)) stop("File not found: ", file)
filecluster<-read.table(file,header=T,sep=" ",dec=".")
beta<-as.matrix(filecluster[,2:(length(filecluster[1,])-1)])

now my input is like this:

https://github.com/eleporcu/TWMR/blob/master/ENSG00000000419.matrix

so 4 columns instead of 3 like it was before and when I run it I get that
error above.

Please advise,
Ana

	[[alternative HTML version deleted]]



More information about the R-help mailing list