Seb, On 17 November 2007 at 15:16, Sebastian P. Luque wrote: | Hi, | | I've been using r (the little, but sweet one!), and recently found out
It's also way cuter than the ugly Rscript. But heck, I'm one of the parents, so I had to say that :) | about the magic argv vector of the rest of arguments passed to it. How | can we process an argument that represents elements of a vector: | | $ r littler_ex.R 14 '3, 2' | Error in ff * ss : non-numeric argument to binary operator | | where: | | ,-----[ cat ~/scripts/R/littler_ex.R ] | | ff <- as.numeric(argv[1]) | | ss <- c(argv[2]) | | print(ff * ss) | `----- You're almost there -- just use 'as.numeric' on ss too: [EMAIL PROTECTED]:~> cat /tmp/seb.r #!/usr/bin/env r ff <- as.numeric(argv[1]) ss <- as.numeric(argv[2]) print(ff * ss) [EMAIL PROTECTED]:~> /tmp/seb.r 2 3 [1] 6 [EMAIL PROTECTED]:~> There are a few examples of argv use in the examples directory: [EMAIL PROTECTED]:~> grep -c argv /usr/share/doc/littler/examples/*r /usr/share/doc/littler/examples/fsizes.r:0 /usr/share/doc/littler/examples/install.r:2 /usr/share/doc/littler/examples/mph.r:2 /usr/share/doc/littler/examples/pace.r:3 /usr/share/doc/littler/examples/update.r:0 Hope this helps, Dirk -- Three out of two people have difficulties with fractions. _______________________________________________ R-SIG-Debian mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-debian

