Re: [Rd] 0.45<0.45 = TRUE (PR#10744)
> I'm thinking (by now quite strongly) that there is a place > in "Introduction to R" (and maybe other basic documentation) > for an account of arithmetic precision in R (and in digital > computation generally). > > A section "Arithmetic Precision in R" near the beginning > would alert people to this issue (there is nothing about it in > "Introduction to R", "R Language Definition", or "R internals"). > > Once upon a time, poeple who did arithmetic knew about this > from hands-on experience (just when do you break out of the > loop when you are dividing 1 by 3 on a sheet of paper?) -- but > now people press buttons on black boxes, and when they find > that 1/3 calculated in two "mathematically equivalent" ways > comes out with two different values, they believe that there > is a bug in the software. It's more than that as though, as floating point addition is no longer guaranteed to be commutative or associative, and multiplication does not distribute over addition. Many concepts that are clear cut in pure math become fuzzy in floating point math - equality, singularity of matrices etc etc. Hadley -- http://had.co.nz/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Uninstall registry key the same for all versions (PR#10746)
On 2/12/2008 1:16 PM, Bos, Roger wrote: > I consider this a feature because when I am done testing the new > version, I just delete the old directory. Deleting the directory is > usually easier than uninstalling. If you ran the installer with the default settings, just deleting the old directory will leave start menu entries in place, so it's better to do a proper uninstall. It also has the advantage of leaving behind files that weren't part of the installation: you never know what lost files you might find there. Duncan Murdoch > > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Duncan Murdoch > Sent: Tuesday, February 12, 2008 1:02 PM > To: Henrik Bengtsson > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [Rd] Uninstall registry key the same for all versions > (PR#10746) > > On 2/12/2008 12:45 PM, Henrik Bengtsson wrote: >> This is a beautiful example on how an added feature matures into a bug > >> over time :) >> >> I let the Windows developers argue with the pro's and con's of your >> suggestion. I just wanna add a related suggestion that when you have >> multiple installations and you run "Unistall R 2.6.0" the first dialog > >> ('R for Windows Uninstall') you see says "Are you sure you want to >> completely remove R for Windows and all of its components?" This >> message does not specify the version being uninstalled, so without >> previous experience you certainly wonder if this is going to install >> all of your R installations or just one. > > I'm just testing now, but I suspect Gerhard's suggestion of specifying > AppID will fix this too. > > Duncan Murdoch > >> >> My $0.02 >> >> /Henrik >> >> On Feb 12, 2008 8:20 AM, <[EMAIL PROTECTED]> wrote: >>> Full_Name: Gerhard Thallinger >>> Version: R 2.2.0 through R 2.6.2 >>> OS: Windows XP >>> Submission from: (NULL) (129.27.145.220) >>> >>> >>> The uninstall key in the Windows Registry >>> (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\) >>> is the same ("R for Windows_is1") for all R versions (at least from >>> 2.2.0 to 2.6.2). >>> >>> This prohibits managing multiple R versions in a clean way, since the > >>> installation of a new R versions overwrites the uninstall key of the >>> previous installed version. This makes an uninstall of a previous >>> version via "Add/Remove Software" impossible. >>> >>> The uninstall key should also contain the R version number (e.g. "R >>> for Windows 2.6.2_is1"). The name of the registry key can be set in >>> the Inno Setup definition file using the "AppId" directive. >>> At the moment "AppId" is not set, therefor "AppName" is used as the >>> key name. >>> >>> __ >>> R-devel@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-devel >>> >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > > ** * > This message is for the named person's use only. It ma...{{dropped:12}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Uninstall registry key the same for all versions (PR#10746)
On 2/12/2008 11:20 AM, [EMAIL PROTECTED] wrote: > Full_Name: Gerhard Thallinger > Version: R 2.2.0 through R 2.6.2 > OS: Windows XP > Submission from: (NULL) (129.27.145.220) > > > The uninstall key in the Windows Registry > (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\) > is the same ("R for Windows_is1") for all R versions > (at least from 2.2.0 to 2.6.2). > > This prohibits managing multiple R versions in a clean way, since > the installation of a new R versions overwrites the uninstall key > of the previous installed version. This makes an uninstall of > a previous version via "Add/Remove Software" impossible. That's true, but it is still easy to uninstall, just by using the start menu entry. > The uninstall key should also contain the R version number > (e.g. "R for Windows 2.6.2_is1"). The name of the registry key can > be set in the Inno Setup definition file using the "AppId" directive. > At the moment "AppId" is not set, therefor "AppName" is used as the > key name. Thanks for the suggestion. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Namespace/method oddity
On Tue, 12 Feb 2008, Peter Dalgaard wrote: > I stumbled on the following: > >> library(stats4) >> example(mle) >> confint.default(fit2) > Error in UseMethod("vcov") : no applicable method for "vcov" > In addition: Warning message: > In object$coefficients : > $ operator not defined for this S4 class, returning NULL >> vcov(fit2) > lymax lxhalf > lymax 0.02857612 -0.04870231 > lxhalf -0.04870231 0.11457338 >> coef(fit2) > lymax lxhalf > 3.218870 1.117006 > > > And confint.default does indeed use the generic extractors vcov() and > coef(). > Q: is this to be expected? and why? (I kind of suspect that this has in > fact been discussed at some point and that I just wasn't paying > attention...) Yes. stats4 contains an object called vcov. confint.default is in the stats namespace and correctly uses stats::vcov not stats4::vcov, which is what you were looking for. It's discussed most weeks, and at R-core in Vienna in 2006 and before that. It is 'issue' 11 in http://developer.r-project.org/BDR_S4issues.txt Brian -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Uninstall registry key the same for all versions (PR#10746)
I consider this a feature because when I am done testing the new version, I just delete the old directory. Deleting the directory is usually easier than uninstalling. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Duncan Murdoch Sent: Tuesday, February 12, 2008 1:02 PM To: Henrik Bengtsson Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [Rd] Uninstall registry key the same for all versions (PR#10746) On 2/12/2008 12:45 PM, Henrik Bengtsson wrote: > This is a beautiful example on how an added feature matures into a bug > over time :) > > I let the Windows developers argue with the pro's and con's of your > suggestion. I just wanna add a related suggestion that when you have > multiple installations and you run "Unistall R 2.6.0" the first dialog > ('R for Windows Uninstall') you see says "Are you sure you want to > completely remove R for Windows and all of its components?" This > message does not specify the version being uninstalled, so without > previous experience you certainly wonder if this is going to install > all of your R installations or just one. I'm just testing now, but I suspect Gerhard's suggestion of specifying AppID will fix this too. Duncan Murdoch > > My $0.02 > > /Henrik > > On Feb 12, 2008 8:20 AM, <[EMAIL PROTECTED]> wrote: >> Full_Name: Gerhard Thallinger >> Version: R 2.2.0 through R 2.6.2 >> OS: Windows XP >> Submission from: (NULL) (129.27.145.220) >> >> >> The uninstall key in the Windows Registry >> (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\) >> is the same ("R for Windows_is1") for all R versions (at least from >> 2.2.0 to 2.6.2). >> >> This prohibits managing multiple R versions in a clean way, since the >> installation of a new R versions overwrites the uninstall key of the >> previous installed version. This makes an uninstall of a previous >> version via "Add/Remove Software" impossible. >> >> The uninstall key should also contain the R version number (e.g. "R >> for Windows 2.6.2_is1"). The name of the registry key can be set in >> the Inno Setup definition file using the "AppId" directive. >> At the moment "AppId" is not set, therefor "AppName" is used as the >> key name. >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel ** * This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No right to confidential or privileged treatment of this message is waived or lost by any error in transmission. If you have received this message in error, please immediately notify the sender by e-mail, delete the message and all copies from your system and destroy any hard copies. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Uninstall registry key the same for all versions (PR#10746)
On 2/12/2008 1:02 PM, Duncan Murdoch wrote: > On 2/12/2008 12:45 PM, Henrik Bengtsson wrote: >> This is a beautiful example on how an added feature matures into a bug >> over time :) >> >> I let the Windows developers argue with the pro's and con's of your >> suggestion. I just wanna add a related suggestion that when you have >> multiple installations and you run "Unistall R 2.6.0" the first dialog >> ('R for Windows Uninstall') you see says "Are you sure you want to >> completely remove R for Windows and all of its components?" This >> message does not specify the version being uninstalled, so without >> previous experience you certainly wonder if this is going to install >> all of your R installations or just one. > > I'm just testing now, but I suspect Gerhard's suggestion of specifying > AppID will fix this too. No, it doesn't. I'll look for something else. Duncan Murdoch > > Duncan Murdoch > >> >> My $0.02 >> >> /Henrik >> >> On Feb 12, 2008 8:20 AM, <[EMAIL PROTECTED]> wrote: >>> Full_Name: Gerhard Thallinger >>> Version: R 2.2.0 through R 2.6.2 >>> OS: Windows XP >>> Submission from: (NULL) (129.27.145.220) >>> >>> >>> The uninstall key in the Windows Registry >>> (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\) >>> is the same ("R for Windows_is1") for all R versions >>> (at least from 2.2.0 to 2.6.2). >>> >>> This prohibits managing multiple R versions in a clean way, since >>> the installation of a new R versions overwrites the uninstall key >>> of the previous installed version. This makes an uninstall of >>> a previous version via "Add/Remove Software" impossible. >>> >>> The uninstall key should also contain the R version number >>> (e.g. "R for Windows 2.6.2_is1"). The name of the registry key can >>> be set in the Inno Setup definition file using the "AppId" directive. >>> At the moment "AppId" is not set, therefor "AppName" is used as the >>> key name. >>> >>> __ >>> R-devel@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-devel >>> >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Namespace/method oddity
I stumbled on the following: > library(stats4) > example(mle) > confint.default(fit2) Error in UseMethod("vcov") : no applicable method for "vcov" In addition: Warning message: In object$coefficients : $ operator not defined for this S4 class, returning NULL > vcov(fit2) lymax lxhalf lymax 0.02857612 -0.04870231 lxhalf -0.04870231 0.11457338 > coef(fit2) lymax lxhalf 3.218870 1.117006 And confint.default does indeed use the generic extractors vcov() and coef(). Q: is this to be expected? and why? (I kind of suspect that this has in fact been discussed at some point and that I just wasn't paying attention...) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Uninstall registry key the same for all versions (PR#10746)
On 2/12/2008 12:45 PM, Henrik Bengtsson wrote: > This is a beautiful example on how an added feature matures into a bug > over time :) > > I let the Windows developers argue with the pro's and con's of your > suggestion. I just wanna add a related suggestion that when you have > multiple installations and you run "Unistall R 2.6.0" the first dialog > ('R for Windows Uninstall') you see says "Are you sure you want to > completely remove R for Windows and all of its components?" This > message does not specify the version being uninstalled, so without > previous experience you certainly wonder if this is going to install > all of your R installations or just one. I'm just testing now, but I suspect Gerhard's suggestion of specifying AppID will fix this too. Duncan Murdoch > > My $0.02 > > /Henrik > > On Feb 12, 2008 8:20 AM, <[EMAIL PROTECTED]> wrote: >> Full_Name: Gerhard Thallinger >> Version: R 2.2.0 through R 2.6.2 >> OS: Windows XP >> Submission from: (NULL) (129.27.145.220) >> >> >> The uninstall key in the Windows Registry >> (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\) >> is the same ("R for Windows_is1") for all R versions >> (at least from 2.2.0 to 2.6.2). >> >> This prohibits managing multiple R versions in a clean way, since >> the installation of a new R versions overwrites the uninstall key >> of the previous installed version. This makes an uninstall of >> a previous version via "Add/Remove Software" impossible. >> >> The uninstall key should also contain the R version number >> (e.g. "R for Windows 2.6.2_is1"). The name of the registry key can >> be set in the Inno Setup definition file using the "AppId" directive. >> At the moment "AppId" is not set, therefor "AppName" is used as the >> key name. >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] 0.45<0.45 = TRUE (PR#10744)
I don't think that we need a full discussion in the Introduction, but how about early on it shows an example of 2 floating point numbers not being equal (and one of the work arounds like all.equal) along with a note (bright, bold, etc.) that says that if the reader did not expect the FALSE result then they should read FAQ 7.31 (and maybe even include a link they can click on right then). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Tuesday, February 12, 2008 8:32 AM > To: [EMAIL PROTECTED] > Subject: Re: [Rd] 0.45<0.45 = TRUE (PR#10744) > > On 12-Feb-08 14:53:19, Gavin Simpson wrote: > > On Tue, 2008-02-12 at 15:35 +0100, [EMAIL PROTECTED] wrote: > >> Dear developer, > >> > >> in my version of R (2.4.0) as weel as in a more recent version > >> (2.6.0) on different computers, we found this problem : > > > > No problem in R. This is the FAQ of all FAQs (Type III SS > is probably > > up there as well). > > I'm thinking (by now quite strongly) that there is a place in > "Introduction to R" (and maybe other basic documentation) for > an account of arithmetic precision in R (and in digital > computation generally). > > A section "Arithmetic Precision in R" near the beginning > would alert people to this issue (there is nothing about it > in "Introduction to R", "R Language Definition", or "R internals"). > > Once upon a time, poeple who did arithmetic knew about this > from hands-on experience (just when do you break out of the > loop when you are dividing 1 by 3 on a sheet of paper?) -- > but now people press buttons on black boxes, and when they > find that 1/3 calculated in two "mathematically equivalent" > ways comes out with two different values, they believe that > there is a bug in the software. > > It would not occur to them, spontaneously, that the computer > is doing the right thing and that they should look in a FAQ > for an explanation of how they do not understand! > > I would be willing to contribute to such an explanation; and > probably many others would too. But I feel it should be > coordinated by people who are experts in the internals of how > R handles such things. > > Best wishes to all, > Ted. > > > E-Mail: (Ted Harding) <[EMAIL PROTECTED]> > Fax-to-email: +44 (0)870 094 0861 > Date: 12-Feb-08 Time: 15:31:26 > -- XFMail -- > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Uninstall registry key the same for all versions (PR#10746)
This is a beautiful example on how an added feature matures into a bug over time :) I let the Windows developers argue with the pro's and con's of your suggestion. I just wanna add a related suggestion that when you have multiple installations and you run "Unistall R 2.6.0" the first dialog ('R for Windows Uninstall') you see says "Are you sure you want to completely remove R for Windows and all of its components?" This message does not specify the version being uninstalled, so without previous experience you certainly wonder if this is going to install all of your R installations or just one. My $0.02 /Henrik On Feb 12, 2008 8:20 AM, <[EMAIL PROTECTED]> wrote: > Full_Name: Gerhard Thallinger > Version: R 2.2.0 through R 2.6.2 > OS: Windows XP > Submission from: (NULL) (129.27.145.220) > > > The uninstall key in the Windows Registry > (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\) > is the same ("R for Windows_is1") for all R versions > (at least from 2.2.0 to 2.6.2). > > This prohibits managing multiple R versions in a clean way, since > the installation of a new R versions overwrites the uninstall key > of the previous installed version. This makes an uninstall of > a previous version via "Add/Remove Software" impossible. > > The uninstall key should also contain the R version number > (e.g. "R for Windows 2.6.2_is1"). The name of the registry key can > be set in the Inno Setup definition file using the "AppId" directive. > At the moment "AppId" is not set, therefor "AppName" is used as the > key name. > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] assigning NULLs to elements of a list
On Tue, 12 Feb 2008, Oleg Sklyar wrote: > Dear developers: > > I have just came across an (unexpected to me) behaviour of lists when > assigning NULLs to list elements. I understand that a NULL is a valid R > object, thus assigning a NULL to a list element should yield exactly the > same result as assigning any other object. So I was surprised when > assigning a NULL in fact removed the element from the list. Is this an > intended behaviour? Yes. > If so, does anybody know where is it documented and > what is a good way around? > One place is FAQ 7.1 -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Uninstall registry key the same for all versions (PR#10746)
Full_Name: Gerhard Thallinger Version: R 2.2.0 through R 2.6.2 OS: Windows XP Submission from: (NULL) (129.27.145.220) The uninstall key in the Windows Registry (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\) is the same ("R for Windows_is1") for all R versions (at least from 2.2.0 to 2.6.2). This prohibits managing multiple R versions in a clean way, since the installation of a new R versions overwrites the uninstall key of the previous installed version. This makes an uninstall of a previous version via "Add/Remove Software" impossible. The uninstall key should also contain the R version number (e.g. "R for Windows 2.6.2_is1"). The name of the registry key can be set in the Inno Setup definition file using the "AppId" directive. At the moment "AppId" is not set, therefor "AppName" is used as the key name. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] assigning NULLs to elements of a list
>From your tone, I gather you don't much like this behavior, and I can see your point, as it not very intuitive that setting a list element to NULL deletes any existing element at that index. But is there a better way to delete an element from a list? Maybe there should be. Jeff Prof Brian Ripley <[EMAIL PROTECTED]> writes: >> I have just came across an (unexpected to me) behaviour of lists when >> assigning NULLs to list elements. I understand that a NULL is a valid R >> object, thus assigning a NULL to a list element should yield exactly the >> same result as assigning any other object. So I was surprised when >> assigning a NULL in fact removed the element from the list. Is this an >> intended behaviour? If so, does anybody know where is it documented and >> what is a good way around? > > Yes, it was apparently intended: R has long done this. > > x <- list(a=c(1L,2L), b=matrix(runif(4),2,2), c=LETTERS[1:3]) > x[2] <- list(NULL) > > is what I think you are intending. > > See e.g. the comment in subassign.c > > /* If "val" is NULL, this is an element deletion */ > /* if there is a match to "nlist" otherwise "x" */ > /* is unchanged. The attributes need adjustment. */ -- Jeff __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] 0.45<0.45 = TRUE (PR#10744)
On 12-Feb-08 14:53:19, Gavin Simpson wrote: > On Tue, 2008-02-12 at 15:35 +0100, [EMAIL PROTECTED] wrote: >> Dear developer, >> >> in my version of R (2.4.0) as weel as in a more recent version >> (2.6.0) on different computers, we found this problem : > > No problem in R. This is the FAQ of all FAQs (Type III SS is > probably up there as well). I'm thinking (by now quite strongly) that there is a place in "Introduction to R" (and maybe other basic documentation) for an account of arithmetic precision in R (and in digital computation generally). A section "Arithmetic Precision in R" near the beginning would alert people to this issue (there is nothing about it in "Introduction to R", "R Language Definition", or "R internals"). Once upon a time, poeple who did arithmetic knew about this from hands-on experience (just when do you break out of the loop when you are dividing 1 by 3 on a sheet of paper?) -- but now people press buttons on black boxes, and when they find that 1/3 calculated in two "mathematically equivalent" ways comes out with two different values, they believe that there is a bug in the software. It would not occur to them, spontaneously, that the computer is doing the right thing and that they should look in a FAQ for an explanation of how they do not understand! I would be willing to contribute to such an explanation; and probably many others would too. But I feel it should be coordinated by people who are experts in the internals of how R handles such things. Best wishes to all, Ted. E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 12-Feb-08 Time: 15:31:26 -- XFMail -- __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] 0.45<0.45 = TRUE (PR#10744)
:) It is a good idea, but i don't it would work. We'd have hundreds of emails on R-help and R-devel complaining about mysterious warning messages for code that had been working just fine for two years Gabor On Tue, Feb 12, 2008 at 11:13:36PM +0800, Berwin A Turlach wrote: > On Tue, 12 Feb 2008 15:47:56 +0100 > Gabor Csardi <[EMAIL PROTECTED]> wrote: > > > OMG, not again please! > > > > FAQ 7.31. > > Yeah, there seems to be a cluster of that type of questions at the > moment. > > Perhaps it is time to introduce a global option "HaveReadFAQ7.31" whose > default is "FALSE" but can be changed via the normal mechanism to > "TRUE". > > Any comparison of numeric values/vectors should print a warning message > "You are comparing numbers calculated using finite precision > arithmetic, have you read FAQ 7.31." while the value of this option is > FALSE. > > Perhaps that will help. :) > > Cheers, > > Berwin > > === Full address = > Berwin A TurlachTel.: +65 6516 4416 (secr) > Dept of Statistics and Applied Probability+65 6516 6650 (self) > Faculty of Science FAX : +65 6872 3919 > National University of Singapore > 6 Science Drive 2, Blk S16, Level 7 e-mail: [EMAIL PROTECTED] > Singapore 117546http://www.stat.nus.edu.sg/~statba -- Csardi Gabor <[EMAIL PROTECTED]>UNIL DGM __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] 0.45<0.45 = TRUE (PR#10744)
On Tue, 12 Feb 2008 15:47:56 +0100 Gabor Csardi <[EMAIL PROTECTED]> wrote: > OMG, not again please! > > FAQ 7.31. Yeah, there seems to be a cluster of that type of questions at the moment. Perhaps it is time to introduce a global option "HaveReadFAQ7.31" whose default is "FALSE" but can be changed via the normal mechanism to "TRUE". Any comparison of numeric values/vectors should print a warning message "You are comparing numbers calculated using finite precision arithmetic, have you read FAQ 7.31." while the value of this option is FALSE. Perhaps that will help. :) Cheers, Berwin === Full address = Berwin A TurlachTel.: +65 6516 4416 (secr) Dept of Statistics and Applied Probability+65 6516 6650 (self) Faculty of Science FAX : +65 6872 3919 National University of Singapore 6 Science Drive 2, Blk S16, Level 7 e-mail: [EMAIL PROTECTED] Singapore 117546http://www.stat.nus.edu.sg/~statba __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] assigning NULLs to elements of a list
Oleg Sklyar wrote: > Dear developers: > > I have just came across an (unexpected to me) behaviour of lists when > assigning NULLs to list elements. I understand that a NULL is a valid R > object, thus assigning a NULL to a list element should yield exactly the > same result as assigning any other object. So I was surprised when > assigning a NULL in fact removed the element from the list. Is this an > intended behaviour? If so, does anybody know where is it documented and > what is a good way around? This topic is discussed in the R FAQ, in section 7.1 "How can I set components of a list to NULL?" It also shows up in section 3.3.3, in the context of incompatibilities with S. - Steve __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] 0.45<0.45 = TRUE (PR#10744)
On Tue, 2008-02-12 at 15:35 +0100, [EMAIL PROTECTED] wrote: > Dear developer, > > in my version of R (2.4.0) as weel as in a more recent version (2.6.0) > on different computers, we found this problem : No problem in R. This is the FAQ of all FAQs (Type III SS is probably up there as well). See the R FAQ, 7.31, for further information: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f For your example: > all.equal(a, b) [1] TRUE > I hope this helps, and that this is a real bug, if not, I am sorry to > have bothered you. In future - if you aren't sure that you have found a bug in R, and you've done your home work (as per the Posting Guide), post a comment/question on the R Devel list. You'd have gotten the same response (not a bug, read R FAQ 7.31) but you wouldn't have created additional work for one the the R Core Development Team who will now have to deal with your bug report in the R bug tracker. HTH G > > Cheers! > > Jacques. > > -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] 0.45<0.45 = TRUE (PR#10744)
OMG, not again please! FAQ 7.31. Thanks! On Tue, Feb 12, 2008 at 03:35:09PM +0100, [EMAIL PROTECTED] wrote: > Dear developer, > > in my version of R (2.4.0) as weel as in a more recent version (2.6.0) > on different computers, we found this problem : > > > a<-(58/40-1) > > a > [1] 0.45 > > b<-(18/40) > > b > [1] 0.45 > > a [1] TRUE > > a==b > [1] FALSE > > > Something seems wrong here. > but if we do > > > c<-0.45 > > d<-0.45 > > c [1] FALSE > > then everything is ok. > If we use 59 and 19 instead of 58 and 18, the error is not here anymore. > I guess there is a problem with the envelop object for the comparisons > between different types in R (as in JAVA maybe) but I am not familiar > with the R language. > I hope this helps, and that this is a real bug, if not, I am sorry to > have bothered you. > > Cheers! > > Jacques. > > > -- > > ___ > > Jacques Labonne, Chargé de Recherches > UMR ECOBIOP > "Ecologie Comportementale et Biologie des Populations de Poissons" > Pôle d'Hydrobiologie de Saint Pée sur Nivelle, INRA > Quartier Ibarron > 64310 Saint Pée sur Nivelle > Tél : (0)5 59 51 59 80 > ... > site web http://www.st-pee.inra.fr > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Csardi Gabor <[EMAIL PROTECTED]>UNIL DGM __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] 0.45<0.45 = TRUE (PR#10744)
On 2/12/2008 9:35 AM, [EMAIL PROTECTED] wrote: > Dear developer, > > in my version of R (2.4.0) as weel as in a more recent version (2.6.0) > on different computers, we found this problem : This is not a bug, it's a limitation of finite precision arithmetic, and it's FAQ 7.31. Duncan Murdoch > > > a<-(58/40-1) > > a > [1] 0.45 > > b<-(18/40) > > b > [1] 0.45 > > a [1] TRUE > > a==b > [1] FALSE > > > Something seems wrong here. > but if we do > > > c<-0.45 > > d<-0.45 > > c [1] FALSE > > then everything is ok. > If we use 59 and 19 instead of 58 and 18, the error is not here anymore. > I guess there is a problem with the envelop object for the comparisons > between different types in R (as in JAVA maybe) but I am not familiar > with the R language. > I hope this helps, and that this is a real bug, if not, I am sorry to > have bothered you. > > Cheers! > > Jacques. > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] assigning NULLs to elements of a list
On Tue, 12 Feb 2008, Oleg Sklyar wrote: > Dear developers: > > I have just came across an (unexpected to me) behaviour of lists when > assigning NULLs to list elements. I understand that a NULL is a valid R > object, thus assigning a NULL to a list element should yield exactly the > same result as assigning any other object. So I was surprised when > assigning a NULL in fact removed the element from the list. Is this an > intended behaviour? If so, does anybody know where is it documented and > what is a good way around? Yes, it was apparently intended: R has long done this. x <- list(a=c(1L,2L), b=matrix(runif(4),2,2), c=LETTERS[1:3]) x[2] <- list(NULL) is what I think you are intending. See e.g. the comment in subassign.c /* If "val" is NULL, this is an element deletion */ /* if there is a match to "nlist" otherwise "x" */ /* is unchanged. The attributes need adjustment. */ > > Thanks for help, > Oleg Sklyar > > Here goes an example, the inline C-code does exactly what I would prefer > R were doing, but both R examples do remove the element 'b': > > x = list(a=c(1L,2L), b=matrix(runif(4),2,2), c=LETTERS[1:3]) > > library(inline) > code=" > SEXP res; > PROTECT(res = Rf_duplicate(x)); > SET_VECTOR_ELT(res,1,R_NilValue); > UNPROTECT(1); > return res; > " > setnull = cfunction(signature(x="list"),code) > setnull(x) > > # $a > # [1] 1 2 > # $b > # NULL > # $c > # [1] "A" "B" "C" > > y = x > x[[2]] = NULL > x > # $a > # [1] 1 2 > # $c > # [1] "A" "B" "C" > > x = y > x$b = NULL > x > # $a > # [1] 1 2 > # $c > # [1] "A" "B" "C" > > > sessionInfo() > R version 2.6.1 (2007-11-26) > i686-pc-linux-gnu > > locale: > LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] inline_0.3.3 > > loaded via a namespace (and not attached): > [1] rcompgen_0.1-17 > > > -- > Dr Oleg Sklyar * EBI-EMBL, Cambridge CB10 1SD, UK * +44-1223-494466 > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] assigning NULLs to elements of a list
On Tue, Feb 12, 2008 at 11:06:59AM +, Oleg Sklyar wrote: > Dear developers: > > I have just came across an (unexpected to me) behaviour of lists when > assigning NULLs to list elements. I understand that a NULL is a valid R > object, thus assigning a NULL to a list element should yield exactly the > same result as assigning any other object. So I was surprised when > assigning a NULL in fact removed the element from the list. Is this an > intended behaviour? If so, does anybody know where is it documented and > what is a good way around? > > Thanks for help, > Oleg Sklyar > > Here goes an example, the inline C-code does exactly what I would prefer > R were doing, but both R examples do remove the element 'b': > > x = list(a=c(1L,2L), b=matrix(runif(4),2,2), c=LETTERS[1:3]) > > library(inline) > code=" >SEXP res; >PROTECT(res = Rf_duplicate(x)); >SET_VECTOR_ELT(res,1,R_NilValue); >UNPROTECT(1); >return res; > " > setnull = cfunction(signature(x="list"),code) > setnull(x) > > # $a > # [1] 1 2 > # $b > # NULL > # $c > # [1] "A" "B" "C" > > y = x > x[[2]] = NULL Hi Oleg, To do this I use x[2] <- list(NULL) In particular I do this when constructing lists to act as the 'what' argument for scan(), where a NULL element means that the column should be skipped, whereas obviously a non-existent element won't serve that purpose. I would be interested to hear whether this is the 'proper' way to construct such lists. Dan > x > # $a > # [1] 1 2 > # $c > # [1] "A" "B" "C" > > x = y > x$b = NULL > x > # $a > # [1] 1 2 > # $c > # [1] "A" "B" "C" > > > sessionInfo() > R version 2.6.1 (2007-11-26) > i686-pc-linux-gnu > > locale: > LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] inline_0.3.3 > > loaded via a namespace (and not attached): > [1] rcompgen_0.1-17 > > > -- > Dr Oleg Sklyar * EBI-EMBL, Cambridge CB10 1SD, UK * +44-1223-494466 > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] assigning NULLs to elements of a list
Dear developers: I have just came across an (unexpected to me) behaviour of lists when assigning NULLs to list elements. I understand that a NULL is a valid R object, thus assigning a NULL to a list element should yield exactly the same result as assigning any other object. So I was surprised when assigning a NULL in fact removed the element from the list. Is this an intended behaviour? If so, does anybody know where is it documented and what is a good way around? Thanks for help, Oleg Sklyar Here goes an example, the inline C-code does exactly what I would prefer R were doing, but both R examples do remove the element 'b': x = list(a=c(1L,2L), b=matrix(runif(4),2,2), c=LETTERS[1:3]) library(inline) code=" SEXP res; PROTECT(res = Rf_duplicate(x)); SET_VECTOR_ELT(res,1,R_NilValue); UNPROTECT(1); return res; " setnull = cfunction(signature(x="list"),code) setnull(x) # $a # [1] 1 2 # $b # NULL # $c # [1] "A" "B" "C" y = x x[[2]] = NULL x # $a # [1] 1 2 # $c # [1] "A" "B" "C" x = y x$b = NULL x # $a # [1] 1 2 # $c # [1] "A" "B" "C" > sessionInfo() R version 2.6.1 (2007-11-26) i686-pc-linux-gnu locale: LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] inline_0.3.3 loaded via a namespace (and not attached): [1] rcompgen_0.1-17 -- Dr Oleg Sklyar * EBI-EMBL, Cambridge CB10 1SD, UK * +44-1223-494466 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] 0.45<0.45 = TRUE (PR#10744)
Dear developer, in my version of R (2.4.0) as weel as in a more recent version (2.6.0) on different computers, we found this problem : > a<-(58/40-1) > a [1] 0.45 > b<-(18/40) > b [1] 0.45 > a a==b [1] FALSE > Something seems wrong here. but if we do > c<-0.45 > d<-0.45 > chttp://www.st-pee.inra.fr __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel