Re: [R] scan not working

2013-01-27 Thread Emily Sessa
Thank you all - these suggestions have been very helpful! I've got it doing what I wanted know, and I appreciate the help! Emily On Jan 27, 2013, at 1:18 PM, Rui Barradas wrote: > Hello, > > Try the following. Create a file called test.R with these instructions: > > cmd <- commandArgs(TRUE)

Re: [R] scan not working

2013-01-27 Thread Rui Barradas
Hello, Try the following. Create a file called test.R with these instructions: cmd <- commandArgs(TRUE) if(any(grepl("--ext", cmd))){ suffix <- cmd[grep("--ext", cmd)] suffix <- unlist(strsplit(suffix, ":"))[2] fl <- paste0("test_", suffix, ".txt") # underscore included }

Re: [R] scan not working

2013-01-27 Thread Steve Lianoglou
Hi, It sounds like you just want to write a command line script using R and you would pass the suffix/prefix as command line args, no? Why not just go with what Peter has already suggested with `commandArgs`, or if you want a more feature-rich command line arg parser, you can try: http://cran.r-

Re: [R] scan not working

2013-01-27 Thread Emily Sessa
Hello all (again), I received a very helpful answer to this question, and would like to pose one more: Right now I have this script, which is being called from the command line, writing output to two generically named files ("pvalues" and "qvalues") that are named in the script using the lin

Re: [R] scan not working

2013-01-27 Thread peter dalgaard
On Jan 27, 2013, at 08:33 , Emily Sessa wrote: > Hi all, > > I am trying to use the scan function in an R script that I am calling from > the command line on a Mac; at the shell prompt I type: > > $ Rscript get_q_values.R LRT_codeml_output > > in the hope that LRT_codeml_output will get pa

[R] scan not working

2013-01-27 Thread Emily Sessa
Hi all, I am trying to use the scan function in an R script that I am calling from the command line on a Mac; at the shell prompt I type: $ Rscript get_q_values.R LRT_codeml_output in the hope that LRT_codeml_output will get passed to the get_q_values R script. The first line of that script