Entering edit mode
9.5 years ago
hessjl
▴
90
I'll first layout the block of R code that I'm working on:
for( I in 1:length(input_names)){
input_names[[i]] -> MYDATA
system("./plink --noweb --bfile MYDATA --freq --out test[[i]]")
}
This will return an error as there is no file named "MYDATA" in the working directory. The point is that I want the system command plink to recognize MYDATA as a R object, retrieve the filename whose string matches that of MYDATA, and perform the function --freq
and write the results to file name test (test1, test2, test3, ...etc.,).
Is there any way to use system( ) in a for loop on special R objects? If so, please explain how that is done.
Puzzled and thankful,
Jon
Any reason for not using a bash script or even Python? R seems an odd choice for this particular task.
As general interest to know if R can do this, since it's my go-to language.