Hello,
I need to run this small R script from LEA r package for 100 files:
mb10 <- fread("wind43.geno") # this is the file after replacing -1 by 9
write.geno(mb10, "genotypes_chr09A_10mb.geno")
output = geno2lfmm("wind43.geno")
I think one option is to do for loop, I have written this:
the_dir <- "pca_1mbp_window/GENO/geno"
fileNames <- Sys.glob("*.geno")
for (file in fileNames) {
# read data:
wind <- fread(fileNames)
write.geno(wind, the_dir, basename(file))
output=geno2lfmm("file")
}
But i am getting this error:
Error in fread(fileNames) : input= must be a single character string containing a file name, a system command containing at least one space, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or, the input data itself containing at least one \n or \r
Is this the correct way? How I would run the script for 100 files at once?
fread(fileNames) instead of fread(file)