[R] logarithmic seq() ?

(Ted Harding) Ted.Harding at manchester.ac.uk
Mon Sep 21 21:32:24 CEST 2009


On 21-Sep-09 18:47:50, Oliver Bandel wrote:
> Hello,
> in scilab /Matlab there are functions that can create linear
> sequences (like R's seq()) as well as logarithmic sequences.
> 
> 
> Is there a logarithmic aequivalent of seq()?
> Or maybe this would be an idea for newer R-releases,
> maybe a type-option with "linear" and "logarithmic" as
> parameters....?!
> 
> Ciao,
>   Oliver

If you mean going from a to b by "logarithmically equal" steps,
then you can quite readily implement it yourself. For example:

exp(log(10)*seq(log10(1),log10(100),by=0.25)
[1]   1.000000   1.778279   3.162278   5.623413  10.000000
[6]  17.782794  31.622777  56.234133 100.000000

One could turn this sort of thing into a function, though a
function which includes the various ways of doing it that are
encapsulated in plain seq() would be quite complicated for a
"normal" user to write, so I think there is an argument for
your proposal!

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 21-Sep-09                                       Time: 20:32:22
------------------------------ XFMail ------------------------------




More information about the R-help mailing list