Suppose I have a dataframe that looks like this:
SNP Frequency
A 20
B 50
C 7
(The real dataframe has many more rows, of course.)
What I would like to do is pass some arguments to the command line that would allow me to set the input dataframe and the frequency in the command line. Here is what I have tried:
args = commandArgs()
df <-args[1]
freqsub <- subset(df, args[2],header=TRUE)
In the args[2] part I would ordinarily have Frequency > somenumber
I know how to work it when I have df <- args[1], but args[2] doesn't.
$ Rscript sumtest.R test.txt Frequency>20
"Error in subset.default(df, args[2], header = TRUE) :
argument "subset" is missing, with no default
Calls: subset -> subset.default
Execution halted"
Any ideas? Happy to edit if more information is required (I can't tell if it is the case, sorry).