Re: [Rd] mean relative differences from all.equal() (PR#9276)

2006-10-04 Thread MSchwartz
On Thu, 2006-10-05 at 03:10 +0200, [EMAIL PROTECTED] wrote:
 Full_Name: Brad Christoffersen
 Version: 2.3.1
 OS: Windows XP
 Submission from: (NULL) (128.196.193.132)
 
 
 Why is the difference between two numbers so different from the mean relative
 difference output from the all.equal() function?  Is this an artifact of the
 way R stores numerics?  I could not find this problem as I searched through 
 the
 submitted bugs. But I am brand new to R so I apologize if there is something
 obvious I'm missing here.
 
 rm(list=ls(all=TRUE))  ## Remove all objects that could hinder w/ consistent
 output
 a - 204
 b - 203.9792
 all.equal(a,b)
 [1] Mean relative  difference: 0.0001019608
 a - b
 [1] 0.0208

Read the Details section of ?all.equal, which states:

Numerical comparisons for scale = NULL (the default) are done by first
computing the mean absolute difference of the two numerical vectors. If
this is smaller than tolerance or not finite, absolute differences are
used, otherwise relative differences scaled by the mean absolute
difference.

If scale is positive, absolute comparisons are made after scaling
(dividing) by scale


Thus on R version 2.4.0 (2006-10-03):

 all.equal(a, b, scale = 1)
[1] Mean scaled  difference: 0.0208


Please do not report doubts about behavior as bugs.  Simply post a query
on r-help first. If it is a bug, somebody will confirm it and you can
then report it as such.

BTW, time to upgrade...Go Wildcats!

HTH,

Marc Schwartz

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] mean relative differences from all.equal() (PR#9276)

2006-10-04 Thread MSchwartz
On Wed, 2006-10-04 at 20:22 -0500, Marc Schwartz wrote:
 On Thu, 2006-10-05 at 03:10 +0200, [EMAIL PROTECTED] wrote:
  Full_Name: Brad Christoffersen
  Version: 2.3.1
  OS: Windows XP
  Submission from: (NULL) (128.196.193.132)
  
  
  Why is the difference between two numbers so different from the mean 
  relative
  difference output from the all.equal() function?  Is this an artifact of 
  the
  way R stores numerics?  I could not find this problem as I searched through 
  the
  submitted bugs. But I am brand new to R so I apologize if there is something
  obvious I'm missing here.
  
  rm(list=ls(all=TRUE))  ## Remove all objects that could hinder w/ consistent
  output
  a - 204
  b - 203.9792
  all.equal(a,b)
  [1] Mean relative  difference: 0.0001019608
  a - b
  [1] 0.0208
 
 Read the Details section of ?all.equal, which states:
 
 Numerical comparisons for scale = NULL (the default) are done by first
 computing the mean absolute difference of the two numerical vectors. If
 this is smaller than tolerance or not finite, absolute differences are
 used, otherwise relative differences scaled by the mean absolute
 difference.
 
 If scale is positive, absolute comparisons are made after scaling
 (dividing) by scale
 
 
 Thus on R version 2.4.0 (2006-10-03):
 
  all.equal(a, b, scale = 1)
 [1] Mean scaled  difference: 0.0208
 
 
 Please do not report doubts about behavior as bugs.  Simply post a query
 on r-help first. If it is a bug, somebody will confirm it and you can
 then report it as such.
 
 BTW, time to upgrade...Go Wildcats!
 
 HTH,
 
 Marc Schwartz

[OFFLIST and PRIVATE]

Brad,

A couple of comments.

First, welcome to R. I hope that you enjoy it and find it of value.

If you are not used to open source software and communities (ie. Linux,
etc.), you will find that this community, unlike commercial paid support
forums, tends to be direct with respect to comments. Don't take it
personally.

Be aware that nobody is getting paid to support R. It is developed and
supported on a voluntary basis by a large body of folks, mainly those
known as R Core. Some of them have quite literally risked their
academic careers and livelihood to facilitate R's existence.

You will, over time, get a flavor for the nature of the community and
the interchange that takes place. As a result of the voluntary nature of
the community, there is an a priori expectation that you will have put
forth reasonable efforts to avail yourself of the various support
resources before posting. Especially in the case of a bug report, as a
member of R Core has to manually manage the handling and resolution of
bug reports.

A good place to start is to review the R Posting Guide:

http://www.r-project.org/posting-guide.html

which covers many of these issues and how to go about getting support
via the various sources provided.

That all being said, you will find that R's support mechanisms and
resources are second to none and I would challenge any commercial
software vendor to provide a comparable level of support and expertise.

With respect to your specific question above and how the result is
obtained:

 (a - b) / a
[1] 0.0001019608

Here, 'a' is used as the scaling factor, since you only passed single
values. If these were 'vectors' of values, the scaling factor would be
impacted accordingly.

As a result of R's open source nature, you have access to all of the
source code that is R. You can download the source tarball (archive)
from one of the CRAN mirrors, if you so desire.

In this case, the actual function that is used is called
all.equal.numeric(). This is a consequence of how R uses 'dispatch
methods' after a call to a 'generic' function, such as all.equal(). If
you are not familiar with these terms, the available R documentation is
a good place to start, if you should decide to pursue moving into that
level of detail. If you have experience in other programming languages,
this may be second nature already.

In many cases, R's functions are written in R itself. Others are written
in FORTRAN and/or C that is compiled and linked to R via various calling
mechanisms. Since R is an interpreted language, you can have easy access
to many of the functions within the R console.

Thus, at the R command prompt, you can type:

 all.equal.numeric

[Note without the parens]

which will then display a representation of the function's source code,
enabling you to review how the function works. If you desire to become a
better R user/programmer, this approach provides a reasonable way to see
how functions are coded and to investigate algorithms and techniques.

I hope that the above is helpful.

Best regards,

Marc

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Legend Title missing (PR#9226)

2006-09-14 Thread mschwartz
On Thu, 2006-09-14 at 20:35 +0200, [EMAIL PROTECTED]
wrote:
 Full_Name: Mark O. Kimball
 Version: 2.1
 OS: Linux
 Submission from: (NULL) (128.253.11.148)
 
 
 When log=x is used in a plot() function, the legend title option creates
 room for the text but does not display it. When the log=x function is
 disabled, the text is again displayed. The symbols and/or lines and legend 
 text
 is not affected.

From NEWS for R 2.3.1:

 o  legend() with log axes would place the title in the wrong place.

Upgrade to the current version.

Please don't report bugs on obsolete versions.

HTH,

Marc Schwartz

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] graphics documentation omission (PR#9148)

2006-08-15 Thread mschwartz
On Tue, 2006-08-15 at 21:04 +0200, [EMAIL PROTECTED] wrote:

 ?axis says in Details: (for example,
  if the 'plot' argument 'asp' is set).
 
 The asp argument is not mentioned in ?plot and is not mentioned in ?par.

It is referenced in ?plot.default and ?plot.window, with the former
passing the 'asp' argument to the internal localWindow() function as a
wrapper to the latter.

In the HTML help page for ?axis, the 'asp' word in the quote above is a
live link to ?plot.window. 

That is not helpful of course if one is working within ESS.

Perhaps the See Also in ?axis should point to plot.default and
plot.window?

HTH,

Marc Schwartz

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] graphics documentation omission (PR#9149)

2006-08-15 Thread mschwartz
On Tue, 2006-08-15 at 22:13 +0200, [EMAIL PROTECTED] wrote:
 Thanks, Marc

Happy to help Rich.

 Neither plot.window or plot.default are natural places for me to look for
 argument names.  par and plot are, for me, the natural places.  I realize
 that asp is not a par argument.  Nonetheless, par is still the first place
 to look for arguments that I would use in the ... position of any plot 
 function.
 It would be easy to make a case that asp is the same type of argument as mar
 or fin, thus it would make sense for it to be added to par.

Over the years, more from behavioral modification than from instinct,
I look at ?plot.default when I forget defacto plot() arguments. Of
course, plot.default() is in the See Also in ?plot.

It is rare for me to look at ?plot.window, given the rarity in which I
call it directly.

 There are NO (that is, zero) live links in the Rgui help system.

Yeah. I enabled options(htmlhelp = TRUE) in my .Rprofile for the times
when I use R from the GNOME console, otherwise I am usually in ESS using
emacs 22 from CVS with the XFT patches.

I am not sure that I ever used the .CHM help when I used to run on
Windows, but presume that there is a hyperlink in that format to
parallel the live link in the HTML file.

 help.search(asp) doesn't find anything related to graphics.

Could be added as a \concept presumably in the .Rd files for
plot.default and plot.window. For example:

  \concept{asp aspect ratio}

 ESS is much better for help than Rgui since ESS Rd mode can go to the help
 page for any word that the cursor sits on.  ESS for R help doesn't have the
 links themselves.

Indeed.

Regards,

Marc

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Installation oddity on Fedora Core 5 (PR#8814)

2006-04-27 Thread mschwartz
On Thu, 2006-04-27 at 18:10 +0200, [EMAIL PROTECTED] wrote:
 Hello guys:
 
 I recently installed FC 5 linux and installed R from source. It installed
 fine, but there was an oddity that I want to report. Although I used
 
 ./configure --prefix=/usr/local/R-2.3.0
 
 make
 
 it did not seem to recognize the prefix and went ahead and installed it in
 the source directory -- I usually ``tar xzf'' it to my home directory
 and run the installation scripts from there (as root) to install to
 /usr/local/R-2.3.0
 
 
 This procedure worked fine on earlier versions of Fedora as well as on
 debian and other distros. Wonder if this is a gcc-4.1 or GNU make issue.
 
 Any feedback will be much appreciated.
 
 Tx.
 
 Sudipto.

This question may be akin to Is the computer plugged in?, but did you
also run:

  make install

?

HTH,

Marc Schwartz

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Installation oddity on Fedora Core 5 (PR#8814)

2006-04-27 Thread mschwartz
Hi Sudipto,

OK. Just for clarification:

'make' will simply do the compilation 'in place' in the source directory
tree. No installation is performed here.

'make install' will actually do the installation into the target folder.

You can do 'make install' without 'make' first, but I suspect a lot of
folks, myself included, will run 'make' first and then run 'make
check-all' before installing, to be sure that the compilation is intact
and passes all checks. 

In fact, I keep the output of 'make check-all' as part of my
installation validation documentation.

That being said, were there any error messages output during 'make
install' that might suggest a problem such as access permission issues
to the target directory or the like?

You might also want to run (I think this is correct):

 dmesg

in a console to look for any 'avc' error messages in the error log. This
would be related to FC5's use of SELinux and there have been very
significant SELinux related policy changes in FC5 that could feasibly be
involved here also.

HTH,

Marc


On Thu, 2006-04-27 at 11:25 -0500, Sudipto Banerjee wrote:
 Hi Marc:
 
 Thanks for your reply. Yeah, I did do
 
 make install
 
 and also tried it with simply make (which is, I presume, enough to
 produce the executable scripts for R).
 
 Please keep me posted.
 
 Best,
 
 S.

 
 On Thu, 27 Apr 2006, Marc Schwartz (via MN) wrote:
 
  On Thu, 2006-04-27 at 18:10 +0200, [EMAIL PROTECTED] wrote:
   Hello guys:
  
   I recently installed FC 5 linux and installed R from source. It installed
   fine, but there was an oddity that I want to report. Although I used
  
   ./configure --prefix=/usr/local/R-2.3.0
  
   make
  
   it did not seem to recognize the prefix and went ahead and installed it in
   the source directory -- I usually ``tar xzf'' it to my home directory
   and run the installation scripts from there (as root) to install to
   /usr/local/R-2.3.0
  
  
   This procedure worked fine on earlier versions of Fedora as well as on
   debian and other distros. Wonder if this is a gcc-4.1 or GNU make issue.
  
   Any feedback will be much appreciated.
  
   Tx.
  
   Sudipto.
 
  This question may be akin to Is the computer plugged in?, but did you
  also run:
 
make install
 
  ?
 
  HTH,
 
  Marc Schwartz
 

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] sub returns garbage (PR#8687)

2006-03-16 Thread mschwartz
On Thu, 2006-03-16 at 22:28 +0100, [EMAIL PROTECTED] wrote:
 Full_Name: Todd Bailey
 Version: 2.1
 OS: Mac OS-X 10.4.3
 Submission from: (NULL) (87.112.79.124)
 
 
 sub returns garbage in some strings when replacing something with nothing and
 fixed=TRUE.  For example:
 
  a=c('hello','hello'); sub('lo','',a,fixed=TRUE)
 [1] hel hel\0\0
  a=c('hello','hello'); sub('lo','',a,fixed=FALSE)
 [1] hel hel


This has been fixed in R Patched. From NEWS:

 o  sub(fixed = TRUE) could get wrong the length of the character
string of elements of the result after the first.


From my installation:

 a - c('hello', 'hello'); sub('lo', '', a, fixed=TRUE)
[1] hel hel

 a - c('hello', 'hello'); sub('lo', '', a, fixed=FALSE)
[1] hel hel


HTH,

Marc Schwartz

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] (Debian Bug 344248): R segfaults when pressing Delete (PR#8421)

2005-12-21 Thread MSchwartz
On Wed, 2005-12-21 at 15:00 +0100, [EMAIL PROTECTED] wrote:
 --CE+1k2dSO48ffgeK
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Resend after type in mailheader.  I have the bug on my system with
 yesterday's R 2.2.1. A library mismatch is still a likely cause.
 
 Dirk

SNIP

 On 21 December 2005 at 01:50, Ethan Glasser-Camp wrote:
 | Package: r-base-core
 | Version: 2.2.1-1
 | 
 | When I run R, I can cause a crash by simply pressing Delete. Backspace works
 | fine, and I can use ESS without problems.
 
 Uh-oh.
 
 | [EMAIL PROTECTED]:~$ R
 | 
 | R : Copyright 2005, The R Foundation for Statistical Computing
 | Version 2.2.1  (2005-12-20 r36812)
 | ISBN 3-900051-07-0
 | 
 | R is free software and comes with ABSOLUTELY NO WARRANTY.
 | You are welcome to redistribute it under certain conditions.
 | Type 'license()' or 'licence()' for distribution details.
 | 
 | R is a collaborative project with many contributors.
 | Type 'contributors()' for more information and
 | 'citation()' on how to cite R or R packages in publications.
 | 
 | Type 'demo()' for some demos, 'help()' for on-line help, or
 | 'help.start()' for an HTML browser interface to help.
 | Type 'q()' to quit R.
 | 
 | [Previously saved workspace restored]
 
 Could you (temporarily) remove that file?
 
 |  Segmentation fault
 | [EMAIL PROTECTED]:~$
 
 That said, I just tried this where I seemed to have no ~/.RData file.
 Pressing DeletetReturn leads to a SegFault.
 
 I will pass this on R Core. 
 
 Thanks for the bug report.
  
 Dirk
 
 | 
 | 
 | Here is a list of packages I thought might be relevant:
 | 
 | $ dpkg -l r-* libreadline*
 | Desired=Unknown/Install/Remove/Purge/Hold
 | | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
 | |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: 
 uppercase=bad)
 | ||/ Name   VersionDescription
 | 
 +++-==-==-
 | un  libreadline-co none (no description available)
 | un  libreadline-de none (no description available)
 | ii  libreadline-ru 1.8.3+1.8.4pre Readline interface for Ruby 1.8
 | ii  libreadline4   4.3-18 GNU readline and history libraries, 
 run-time
 | un  libreadline4-d none (no description available)
 | ii  libreadline5   5.1-1  GNU readline and history libraries, 
 run-time
 | ii  libreadline5-d 5.1-1  GNU readline and history libraries, 
 developm
 | ii  r-base 2.2.1-1GNU R statistical computing language and 
 env
 | ii  r-base-core2.2.1-1GNU R core of statistical computing 
 language
 | un  r-base-dev none (no description available)
 | ii  r-base-html2.2.1-1GNU R html docs for statistical computing 
 sy
 | ii  r-base-latex   2.2.1-1GNU R LaTeX docs for statistical 
 computing s
 | ii  r-cran-boot1.2.24-1   GNU R package for bootstrapping functions 
 fr
 | ii  r-cran-cluster 1.10.2-1   GNU R package for cluster analysis by 
 Rousse
 | ii  r-cran-foreign 0.8.12-1   GNU R package to read/write data from 
 other
 | ii  r-cran-gdata   2.1.2-1GNU R package with data manipulation 
 tools b
 | ii  r-cran-gplots  2.2.0-1GNU R package with tools for plotting 
 data b
 | un  r-cran-gregmis none (no description available)
 | ii  r-cran-gtools  2.2.2-1GNU R package with R programming tools by 
 Gr
 | ii  r-cran-kernsmo 2.22.15-1  GNU R package for kernel smoothing and 
 densi
 | ii  r-cran-lattice 0.12-11.1-1GNU R package for 'Trellis' graphics
 | ii  r-cran-lattice 0.1.1-1GNU R package of additional graphical 
 displa
 | ii  r-cran-mgcv1.3-12-1   GNU R package for multiple parameter 
 smoothi
 | ii  r-cran-misc3d  0.3-1-1GNU R collection of 3d plot functions and 
 rg
 | ii  r-cran-nlme3.1.62-1   GNU R package for (non-)linear mixed 
 effects
 | ii  r-cran-quadpro 1.4.7-2GNU R package for solving quadratic 
 programm
 | ii  r-cran-rgl 0.65-1 GNU R package for three-dimensional 
 visualis
 | ii  r-cran-rpart   3.1.27-1   GNU R package for recursive partitioning 
 and
 | ii  r-cran-surviva 2.20-1 GNU R package for survival analysis
 | un  r-cran-tkrplot none (no description available)
 | ii  r-cran-vr  7.2.23-1   GNU R package accompanying the Venables 
 and
 | un  r-doc-html none (no description available)
 | ii  r-doc-info 2.2.1-1GNU R info manuals statistical computing 
 sys
 | un  r-doc-pdf  none (no description available)
 | un  r-mathlib  none (no description available)
 | ii  r-recommended  2.2.1-1GNU R collection of recommended packages 
 [me
 | 
 | 
 | Please let me know if there is anything else I can do to help.
 | 
 | Ethan


FWIW, I cannot replicate the segfault on FC4, with:

  Version 2.2.1  (2005-12-20 r36812)

compiled from source yesterday.

I have:

$ 

Re: [Rd] package unlisted (PR#8410)

2005-12-18 Thread MSchwartz
On Sun, 2005-12-18 at 15:31 +0100, [EMAIL PROTECTED] wrote:
 Full_Name: Cesar Henrique Torres
 Version: 2.2.0
 OS: winXP-pro
 Submission from: (NULL) (201.1.196.50)
 
 
 Hi developer's!
 
 I'd like to know were gtools package is, because in the link below it isn't:
 http://cran.r-project.org/bin/windows/contrib/r-release/
 This package is used in gplots and I'm trying to make a balloonplot.
 
 Thanks a lot,
 Cesar Torres.

Please do not post bugs on Contributed packages to the main R-bugs repo.
This now requires intervention by a member of R Core, none of whom are
in a position to resolve the problem. You should contact the package
maintainer instead. In this case it is Nitin Jain
([EMAIL PROTECTED]) who I have cc'd here.

The problem here is that the current version of gtools for Windows is
not passing the required checks before it can be allowed to be included
in the main CRAN repo.  This can be seen here:

http://cran.r-project.org/bin/windows/contrib/checkSummaryWin.html

On the above, scroll down to gtools and you will see links for the
following error log and interim resolution:

http://cran.r-project.org/bin/windows/contrib/2.2/check/gtools-check.log

http://cran.r-project.org/bin/windows/contrib/2.2/last/ReadMe


This brings you to:

http://cran.r-project.org/bin/windows/contrib/2.2/last/

where you will find the last version of gtools for Windows that passed
the required checks. This will need to be manually downloaded and may or
may not work in the presence of the other related packages given the
potential for version related conflicts. I suspect Nitin will have more
definitive comments.

HTH,

Marc Schwartz

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Rgnome depends on obsolete components libglade/libxml (PR#8248)

2005-10-24 Thread mschwartz
On Mon, 2005-10-24 at 17:14 +0100, Hin-Tak Leung wrote:
 Peter Dalgaard wrote:
  [EMAIL PROTECTED] writes:
  
  
 Full_Name: Hin-Tak Leung
 Version: R 2.2.0
 OS: x86 linux
 Submission from: (NULL) (131.111.126.242)
 
 
 Rgnome depends libglade 0.x and libxml 1.x .
 
 They are no longer shipped with Redhat EL4.
 (I know they are still in fedora core 4).
 
 Just a wish-list.
  
  
  But what is the wish? 
  
  You mean get it upgraded to xml2 and glade2? Patches would likely be
  accepted... 
  
 
 :-). libglade went from 0.17 to 1.99 then 2.x, but the current Rgnome 
 code depends on some of 0.17-specific stuff.
 
 Already tried against libglade 2 - not trivial. It probably also 
 requires changing to gtk2 also...
 
 Just like to have it in the distant TODO list, and not forgotten...
 
 Hin-Tak Leung


According to the R Admin manual (2.2.0) on page 34:

This interface is experimental and incomplete. The console offers a
basic command line editing and history mechanism, along with tool and
button bars that give a point-and-click console to some R commands. Many
of the features of the console are currently stubs, and the console is
**no longer under development**: it has been kept available as an
example of adding a front-end to R.


This language (my emphasis added) would suggest that a TODO list does
not (or should not) exist...so Peter's suggestion would seem spot on.

HTH,

Marc Schwartz

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Trouble with ifelse and if statement (PR#7962)

2005-06-21 Thread MSchwartz
On Wed, 2005-06-22 at 04:46 +0200, [EMAIL PROTECTED] wrote:
 Full_Name: Woolton Lee
 Version: 2.1
 OS: windows
 Submission from: (NULL) (128.118.224.46)
 
 
 I did the following ('g' and 'h' are both numeric vectors)
  i - abs(g-h)
 creating a vector 'i' with values,
  i
  [1] 0.08 0.00 0.33 0.00 0.00 0.00 0.00 0.33 0.00 0.00 0.08 0.08 0.20 0.00 
 0.13
 
 Now, I want to create a new vector =1 whenever 'i' = 0.33 and =0 otherwise.  I
 use the 'ifelse' function to do this but when I do, I find
  ifelse(i==0.33,1,0)
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 
 even though the third and eighth elements of 'i' clearly equal 0.33.  Unless I
 have missed something, 'ifelse' should return a vector that looks like,
 [1] 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0
 
 When I try 0.13 I get a correct result
  ifelse(i==0.13,1,0)
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
 
 but when I try 0.08 or 0.2 I find a similar problem,
  ifelse(i==0.08,1,0)
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  ifelse(i==0.20,1,0)
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  ifelse(i==0.2,1,0)
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 
 Can you explain what is happening?  Why is R incorretly returning a vector 
 that
 does not reflect the values in 'i'?  Is this due to a malfunction in R or 
 have I
 missed something?
 
 Thank you for your help.
 
 Woolton

This is not a bug and yes you have missed something.

Read R FAQ 7.31 Why doesn't R think these numbers are equal?

More information is also available here:

http://grouper.ieee.org/groups/754/


One possible solution:

 i
 [1] 0.08 0.00 0.33 0.00 0.00 0.00 0.00 0.33 0.00 0.00 0.08 0.08 0.20
[14] 0.00 0.13

 ifelse(sapply(i, function(x) all.equal(x, 0.33)) == TRUE, 1, 0)
 [1] 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0

 ifelse(sapply(i, function(x) all.equal(x, 0.08)) == TRUE, 1, 0)
 [1] 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0

 ifelse(sapply(i, function(x) all.equal(x, 0.2)) == TRUE, 1, 0)
 [1] 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0


Marc Schwartz

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel