ben.hansen at umich.edu
2008-Feb-01 23:35 UTC
[Rd] argument order for Math2 group functions in R 2.6.x (PR#10679)
Full_Name: Ben Hansen Version: 2.6.1 OS: Windows Submission from: (NULL) (66.93.3.101) Hi, In R 2.6.0 or 2.6.1 on Windows, I get the following upon opening the GUI (no previous commands or special settings):> signif(digits=4, x=1/3)[1] 4 It seems to be taking 4 to be the "x" argument, the number to be rounded. However, my understanding (perhaps mistaken) was that it should respond as follows:> signif(digits=4, x=1/3)[1] 0.3333 (This last is what I get from R 2.5.0 running on the same machine, and what I'm used to getting using earlier versions.) Similar things happen with round(). I haven't yet had the opportunity to investigate whether I'd see the same behavior on other platforms. Best wishes, Ben
John Fox
2008-Feb-02 14:32 UTC
[Rd] argument order for Math2 group functions in R 2.6.x (PR#10679)
NO Dear Ben, If you take a look at the definition of signif() in R 2.6.1 and, e.g., in R 2.5.1 you'll see the source of the problem: R 2.6.1:> signiffunction (x, digits = 6) .Primitive("signif") R 2.5.1:> signiffunction (x, digits = 6) .Internal(signif(x, digits)) <environment: namespace:base>>From ?Primitive:"The advantage of .Primitive over .Internal functions is the potential efficiency of argument passing. However, this is done by ignoring argument names and using positional matching of arguments (unless arranged differently for specific primitives such as rep), so this is discouraged for functions of more than one argument." I guess that in recoding signif() for efficiency, the warning about multiple arguments was ignored. Regards, John On Sat, 2 Feb 2008 00:35:03 +0100 (CET) ben.hansen at umich.edu wrote:> Full_Name: Ben Hansen > Version: 2.6.1 > OS: Windows > Submission from: (NULL) (66.93.3.101) > > > Hi, > > In R 2.6.0 or 2.6.1 on Windows, I get the following upon opening the > GUI (no > previous commands or special settings): > > signif(digits=4, x=1/3) > [1] 4 > > It seems to be taking 4 to be the "x" argument, the number to be > rounded. > However, my understanding (perhaps mistaken) was that it should > respond as > follows: > > signif(digits=4, x=1/3) > [1] 0.3333 > > (This last is what I get from R 2.5.0 running on the same machine, > and what I'm > used to getting using earlier versions.) Similar things happen with > round(). > > I haven't yet had the opportunity to investigate whether I'd see the > same > behavior on other platforms. > > Best wishes, > Ben > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel-------------------------------- John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/
Maybe Matching Threads
- argument order for Math2 group functions in R 2.6.x (PR#10683)
- argument order for Math2 group functions in R 2.6.x (PR#10681)
- range( <dates>, na.rm = TRUE ) (PR#10508)
- [Kurt.Hornik@wu-wien.ac.at: Re: range( <dates>, na.rm = TRUE )] (PR#10508)
- round() and signif() do not check argument names when a single argument is given