[Rd] Getting the bare R version number {was "2.0.1 buglets"}

Martin Maechler maechler at stat.math.ethz.ch
Fri Nov 5 09:58:48 CET 2004


>>>>> "PaulG" == Paul Gilbert <pgilbert at bank-banque-canada.ca>
>>>>>     on Thu, 04 Nov 2004 20:26:04 -0500 writes:


    >> If you want the R version, that is 'R --version'.
    >> 
    >> 
    PaulG> I've been using this, but to make it into a file name
    PaulG> I need to do some stripping out of the extra
    PaulG> stuff. (And tail and head on Solaris do not use -n
    PaulG> whereas Linux wants this, so it becomes difficult to
    PaulG> be portable.) Is there a way to get just "R-2.0.1"
    PaulG> from R or R CMD something?

yes, by applying Brian's advice and good ol' "sed" :

  R --version | sed -n '1s/ /-/; 1s/ .*//p'

Martin



More information about the R-devel mailing list