Re: [Rd] Typo (?) in 'aggregate.formula'

From: Suharto Anggono Suharto Anggono <suharto_anggono_at_yahoo.com>
Date: Mon, 03 Sep 2012 03:05:56 -0700 (PDT)


No, I didn't actually get bitten by this. I used 'aggregate.formula' only recently. I saw this when trying to know how 'aggregate.formula' worked, especially in accepting dot (.) in left-hand side of formula. Thanks for the fix.

> From: peter dalgaard <pdalgd_at_gmail.com>
> Subject: Re: [Rd] Typo (?) in 'aggregate.formula'
> To: "Suharto Anggono Suharto Anggono" <suharto_anggono_at_yahoo.com>
> Cc: R-devel_at_r-project.org
> Date: Monday, 3 September, 2012, 4:43 PM
> This (and more) was fixed in r-devel
> back in May. Did you actually get bitten by this? (The code
> has been there for years, so it hasn't been slated for
> R-patched.)
>
> -pd
>
> On Sep 3, 2012, at 11:06 , Suharto Anggono Suharto Anggono
> wrote:
>
> > In the code for 'aggregate.formula', there is
> > if (as.character(formula[[2L]] == "."))
> > I believe that it is meant to be
> > if (as.character(formula[[2L]]) == ".")
> >
> > However,
> > if (as.character(formula[[2L]] == "."))
> > gives the expected result.
> > Tracing:
> > - formula[[2L]] == "."
> > is equivalent to
> > as.character(formula[[2L]]) == "."
> > From the help page for '==' (Comparison), "Language
> objects such as symbols and calls are deparsed to character
> strings before comparison."
> > - By applying 'as.character', the TRUE/FALSE result of
> > formula[[2L]] == "."
> > is converted to character, becomes "TRUE"/"FALSE".
> > - Then, for 'if', it is implicitly converted back to
> logical.
> >
> >
> >> sessionInfo()
> > R version 2.14.2 (2012-02-29)
> > Platform: i386-pc-mingw32/i386 (32-bit)
> >
> > locale:
> > [1] LC_COLLATE=English_United States.1252
> > [2] LC_CTYPE=English_United
> States.1252   
> > [3] LC_MONETARY=English_United States.1252
> > [4] LC_NUMERIC=C         
>                
> > [5] LC_TIME=English_United States.1252   
> >
> > attached base packages:
> > [1] stats     graphics 
> grDevices utils     datasets 
> methods   base     
> >
> >
> > I see that, in R 2.15.1, the code for
> 'aggregate.formula' is still the same.
> >
> > ______________________________________________
> > R-devel_at_r-project.org
> mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
> --
> Peter Dalgaard, Professor
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd.mes_at_cbs.dk 
> Priv: PDalgd_at_gmail.com
>
>



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 03 Sep 2012 - 10:14:23 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Mon 03 Sep 2012 - 14:40:42 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