[Rd] log2(quote(1:10)) evaluates the quoted 1:10, log() does not

From: William Dunlap <wdunlap_at_tibco.com>
Date: Wed, 10 Mar 2010 09:35:39 -0800

This is very minor, but shouldn't log2(quote(1:10)) throw an error,the same as log() and other math functions do? It looks like log2 and log10 evaluate a call object instead of throwing a non-numeric-argument error. They do object to non-call language objects, like expressions.

> log2(quote(1:10))

   [1] 0.000000 1.000000 1.584963 2.000000 2.321928 2.584963    [7] 2.807355 3.000000 3.169925 3.321928
> log(quote(1:10))

  Error in log(quote(1:10)) : Non-numeric argument to mathematical function
> sqrt(quote(1:10))

  Error in sqrt(quote(1:10)) :
    Non-numeric argument to mathematical function
> quote(1:10) ^ 2

  Error in quote(1:10)^2 : non-numeric argument to binary operator
> 2 ^ quote(1:10)

  Error in 2^quote(1:10) : non-numeric argument to binary operator

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 10 Mar 2010 - 17:39:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 12 Mar 2010 - 07:41:04 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive