Re: [Rd] Active bindings in attached environments

2009-11-05 Thread Jeffrey Horner
On Thu, Nov 5, 2009 at 9:53 AM, Jeffrey Horner  wrote:
>
> Hi,
>
> Is this expected behavior for active bindings in attached
> environments, or is this a bug:
>
> > e <- new.env()
> > makeActiveBinding('x',function() 'foo',e)
> > ls(e)
> [1] "x"
> > attach(e)
> > search()
> [1] ".GlobalEnv"        "e"                 "package:graphics"
> [4] "package:grDevices" "package:datasets"  "package:utils"
> [7] "package:methods"   "Autoloads"         "package:base"
> > x
> function() 'foo'
>
> Should this print 'foo' ? The following works as I would expect:
>
> > with(e,x)
> [1] "foo"
>
> but this doesn't:
>
> > f <- function() x
> > f()
> function() 'foo'
>
> However, changing the environment of f does:
>
> > environment(f) <- e
> > f()
> [1] "foo"

Actually, it is my understanding of attach() which is the bug. The
attach documentation clearly states that a copy of the object is
attached, not the object itself.

Thanks,

Jeff
--
http://biostat.mc.vanderbilt.edu/JeffreyHorner

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


[Rd] Typos in ?pdf (was Re: Problem with pdf graphics device)

2009-11-05 Thread Ben Bolker
Marc Schwartz  me.com> writes:

> 

[snip]
 
> See ?pdf and read through the "Note" section.
> 

  While I was reading this I noticed two minor typos
in pdf.Rd.

  These patches are against the latest SVN devel version.


*** pdf.Rd.orig 2009-11-05 14:37:44.0 -0500
--- pdf.Rd  2009-11-05 14:38:24.0 -0500
***
*** 199,205 
problem is much more likely to be in your viewer than in \R.  Try
another viewer if possible.  Symptoms for which the viewer has been at
fault are apparent grids on image plots (turn off graphics
!   anti-aliasing in your viewer if you) and missing or incorrect glyphs
in text (viewers silently doing font substitution).
  
Unfortunately the default viewers on most Linux and Mac OS X systems
--- 199,205 
problem is much more likely to be in your viewer than in \R.  Try
another viewer if possible.  Symptoms for which the viewer has been at
fault are apparent grids on image plots (turn off graphics
!   anti-aliasing in your viewer if you can) and missing or incorrect glyphs
in text (viewers silently doing font substitution).
  
Unfortunately the default viewers on most Linux and Mac OS X systems
***
*** 224,230 
On some systems the default plotting character \code{pch = 1} is
displayed in some PDF viewers incorrectly as a \code{"q"}
character.  (These seem to be viewers based on the \samp{poppler} PDF
!   rendering library). This may be due to incorrect or incomplete mapping
of font names to those used by the system.  Adding the following lines
to \file{~/.fonts.conf} or \file{/etc/fonts/local.conf} may circumvent
this problem.
--- 224,230 
On some systems the default plotting character \code{pch = 1} is
displayed in some PDF viewers incorrectly as a \code{"q"}
character.  (These seem to be viewers based on the \samp{poppler} PDF
!   rendering library.) This may be due to incorrect or incomplete mapping
of font names to those used by the system.  Adding the following lines
to \file{~/.fonts.conf} or \file{/etc/fonts/local.conf} may circumvent
this problem.

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


[Rd] A fix that for 'bquote' that may work (PR#14031)

2009-11-05 Thread suharto_anggono
This is a fix for 'bquote' that may work.

function (expr, where =3D parent.frame())=20
{
unquote <- function(e) {
if (length(e) <=3D 1 || !is.language(e))=20
e
else if (e[[1]] =3D=3D as.name("."))=20
eval(e[[2]], where)
else as.call(lapply(e, unquote))
}
unquote(substitute(expr))
}
=0A=0A=0A  Get your preferred Email name!=0ANow you can @ymail.com and =
@rocketmail.com. =0Ahttp://mail.promotions.yahoo.com/newdomains/aa/

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


[Rd] Error when adding package RMySQL (PR#14044)

2009-11-05 Thread kare
Full_Name: Kåre Jonsson
Version: 2.10
OS: WinXP
Submission from: (NULL) (85.225.178.169)


I made a brand new installation of R 2.10 in two machines and got the same
problem.

Machine 1 is Win XP on metal installation
machine 2 is virtual in VMWare running a hacky OS named Tiny XP in which any
Microsoft windows XP siftware always successfully is installed.

Operation 1. Add package RMySQL from Swedish CRAN.
Operation 2. library(RMySQL)

You can see the textual dump below. I need help to understand what is wrong.

Kind regards,
Kåre Jonsson


> utils:::menuInstallPkgs()
--- Please select a CRAN mirror for use in this session ---
also installing the dependency ‘DBI’

trying URL 
'http://ftp.sunet.se/pub/lang/CRAN/bin/windows/contrib/2.10/DBI_0.2-4.zip'
Content type 'application/zip' length 375508 bytes (366 Kb)
opened URL
downloaded 366 Kb

trying URL 
'http://ftp.sunet.se/pub/lang/CRAN/bin/windows/contrib/2.10/RMySQL_0.7-4.zip'
Content type 'application/zip' length 284408 bytes (277 Kb)
opened URL
downloaded 277 Kb

package 'DBI' successfully unpacked and MD5 sums checked
package 'RMySQL' successfully unpacked and MD5 sums checked

The downloaded packages are in
C:\Documents and Settings\Administrator\Local
Settings\Temp\Rtmpjqc0Bc\downloaded_packages
> library(RMySQL)
Loading required package: DBI
Error in utils::readRegistry("SOFTWARE\\MySQL AB", hive = "HLM", maxdepth = 2) :

  Registry key 'SOFTWARE\MySQL AB' not found
Error : .onLoad failed in 'loadNamespace' for 'RMySQL'
Error: package/namespace load failed for 'RMySQL'
> MySQL()
Error: could not find function "MySQL"
> con <- dbConnect(dbDriver("MySQL"), dbname = "mysql")
Error in do.call(as.character(drvName), list(...)) : 
  could not find function "MySQL"
Error in is(object, Cl) : 
  error in evaluating the argument 'drv' in selecting a method for function
'dbConnect'
> version
   _
platform   i386-pc-mingw32  
arch   i386 
os mingw32  
system i386, mingw32
status  
major  2
minor  10.0 
year   2009 
month  10   
day26   
svn rev50208
language   R
version.string R version 2.10.0 (2009-10-26)
>

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


[Rd] Active bindings in attached environments

2009-11-05 Thread Jeff Horner

Hi,

I was wondering if this is expected behavior for active bindings in 
attached environments, or if this is a bug:


> e <- new.env()
> makeActiveBinding('x',function() 'foo',e)
> ls(e)
[1] "x"
> attach(e)
> search()
[1] ".GlobalEnv""e" "package:graphics"
[4] "package:grDevices" "package:datasets"  "package:utils"
[7] "package:methods"   "Autoloads" "package:base"
> x
function() 'foo' # Should this print 'foo' ?

This works as I would expect:

> with(e,x)
[1] "foo"

but this doesn't:

> f <- function() x
> f()
function() 'foo'

However, changing the environment of f does:

> environment(f) <- e
> f()
[1] "foo"


Jeff

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


[Rd] Typo in R Help INSTALL {utils} (PR#14045)

2009-11-05 Thread neilt
Full_Name: Neil Tiffin
Version: R version 2.10.0 (2009-10-26) 
OS: [R.app GUI 1.30 (5511) i386-apple-darwin9.8.0] 
Submission from: (NULL) (99.68.31.116)


In  the help section 'INSTALL {utils}'  half way down the page the line

Use R CMD INSTALL –help for concise usage information, including all the
available options

should have two '-' in front of help.  Therefor it should read

Use R CMD INSTALL –-help for concise usage information, including all the
available options

At least when I copied and pasted the line it did not work until I added the
second '-'.

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


Re: [Rd] Active bindings in attached environments

2009-11-05 Thread Tony Plate

An explanation of this would be nice in ?makeActiveBinding, e.g.,

NOTE:

When an environment is attach()'ed to the search path, any active 
bindings in it are not preserved as active bindings.  This happens 
because attach() actually adds a new environment to the search path, and 
copies objects into it.  Thus, active bindings are evaluated and their 
values copied into the attached environment.


(Is this explanation correct?)

-- Tony Plate

(PS: Thunderbird wants to spell-correct "makeActiveBinding" to 
"vindictivenesses", which seems an amusingly appropriate allusion to the 
nature of this "gotcha" :-)


Jeffrey Horner wrote:

On Thu, Nov 5, 2009 at 9:53 AM, Jeffrey Horner  wrote:
  

Hi,

Is this expected behavior for active bindings in attached
environments, or is this a bug:



e <- new.env()
makeActiveBinding('x',function() 'foo',e)
ls(e)
  

[1] "x"


attach(e)
search()
  

[1] ".GlobalEnv""e" "package:graphics"
[4] "package:grDevices" "package:datasets"  "package:utils"
[7] "package:methods"   "Autoloads" "package:base"


x
  

function() 'foo'

Should this print 'foo' ? The following works as I would expect:



with(e,x)
  

[1] "foo"

but this doesn't:



f <- function() x
f()
  

function() 'foo'

However, changing the environment of f does:



environment(f) <- e
f()
  

[1] "foo"



Actually, it is my understanding of attach() which is the bug. The
attach documentation clearly states that a copy of the object is
attached, not the object itself.

Thanks,

Jeff
--
http://biostat.mc.vanderbilt.edu/JeffreyHorner

__
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] Error when adding package RMySQL (PR#14044)

2009-11-05 Thread ligges


k...@modlab.se wrote:
> Full_Name: Kåre Jonsson
> Version: 2.10
> OS: WinXP
> Submission from: (NULL) (85.225.178.169)
> 
> 
> I made a brand new installation of R 2.10 in two machines and got the same
> problem.
> 
> Machine 1 is Win XP on metal installation
> machine 2 is virtual in VMWare running a hacky OS named Tiny XP in which any
> Microsoft windows XP siftware always successfully is installed.
> 
> Operation 1. Add package RMySQL from Swedish CRAN.
> Operation 2. library(RMySQL)
> 
> You can see the textual dump below. I need help to understand what is wrong.
> 
> Kind regards,
> Kåre Jonsson
> 
> 
>> utils:::menuInstallPkgs()
> --- Please select a CRAN mirror for use in this session ---
> also installing the dependency ‘DBI’
> 
> trying URL 
> 'http://ftp.sunet.se/pub/lang/CRAN/bin/windows/contrib/2.10/DBI_0.2-4.zip'
> Content type 'application/zip' length 375508 bytes (366 Kb)
> opened URL
> downloaded 366 Kb
> 
> trying URL 
> 'http://ftp.sunet.se/pub/lang/CRAN/bin/windows/contrib/2.10/RMySQL_0.7-4.zip'
> Content type 'application/zip' length 284408 bytes (277 Kb)
> opened URL
> downloaded 277 Kb
> 
> package 'DBI' successfully unpacked and MD5 sums checked
> package 'RMySQL' successfully unpacked and MD5 sums checked
> 
> The downloaded packages are in
> C:\Documents and Settings\Administrator\Local
> Settings\Temp\Rtmpjqc0Bc\downloaded_packages
>> library(RMySQL)
> Loading required package: DBI
> Error in utils::readRegistry("SOFTWARE\\MySQL AB", hive = "HLM", maxdepth = 
> 2) :
> 
>   Registry key 'SOFTWARE\MySQL AB' not found



So you probably forgot to install MySQL?

Why do you think this is a bug in the base R distribution?
Note that bugs of contributed packages (if they are really bugs) should 
be reported to the corresponding package maintainer rather than to the R 
bug tracking system.


Best,
Uwe Ligges



> Error : .onLoad failed in 'loadNamespace' for 'RMySQL'
> Error: package/namespace load failed for 'RMySQL'
>> MySQL()
> Error: could not find function "MySQL"
>> con <- dbConnect(dbDriver("MySQL"), dbname = "mysql")
> Error in do.call(as.character(drvName), list(...)) : 
>   could not find function "MySQL"
> Error in is(object, Cl) : 
>   error in evaluating the argument 'drv' in selecting a method for function
> 'dbConnect'
>> version
>_
> platform   i386-pc-mingw32  
> arch   i386 
> os mingw32  
> system i386, mingw32
> status  
> major  2
> minor  10.0 
> year   2009 
> month  10   
> day26   
> svn rev50208
> language   R
> version.string R version 2.10.0 (2009-10-26)
> 
> __
> 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] Typo in R Help INSTALL {utils} (PR#14045)

2009-11-05 Thread Prof Brian Ripley

The source file reads

  Use \command{R CMD INSTALL --help} for concise usage information,

so I see no 'typo'.

The issue is apparently in the rendering of -- as - in \command.  I 
am presuming you are viewing HTML in the Mac GUI, but can you please 
confirm exactly what you are looking at.


On Thu, 5 Nov 2009, ne...@neiltiffin.com wrote:


Full_Name: Neil Tiffin
Version: R version 2.10.0 (2009-10-26)
OS: [R.app GUI 1.30 (5511) i386-apple-darwin9.8.0]
Submission from: (NULL) (99.68.31.116)


In  the help section 'INSTALL {utils}'  half way down the page the line

Use R CMD INSTALL ?help for concise usage information, including all the
available options

should have two '-' in front of help.  Therefor it should read

Use R CMD INSTALL ?-help for concise usage information, including all the
available options


I suspect from the ? I see (twice) in your message that you are 
seeing an endash and not a single hyphen.  That's what HTML help on 
Linux is showing as for me.



At least when I copied and pasted the line it did not work until I added the
second '-'.


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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] parse_Rd and/or lazyload problem

2009-11-05 Thread luke

On Thu, 5 Nov 2009, mark.braving...@csiro.au wrote:


Great-- thanks for the info.

For now, hopefully I can get the behaviour I want by sticking a .Call( 
'R_lazyLoadDBflush'...) [as per 'detach'] before calling 'lazyLoad'. Seems to 
work on my examples, but please let me know if you don't think it'll work 
generally-- if not, I could presumably create the files under different names 
and then change them.

Is there merit in making 'makeLazyLoadDB' public, just as 'lazyLoad' already 
is? It's useful.


The internals of the lazy load mechanism are intended to be private.
This is now emphasized in the lazyLoad help page.  This is under
active development, and we need the freedom to be able to change these
internals as needed.  They may change without notice, so using them
directly in user code or packages is not a good idea and is strongly
discouraged.

luke



Mark

--
Mark Bravington
CSIRO Mathematical & Information Sciences
Marine Laboratory
Castray Esplanade
Hobart 7001
TAS

ph (+61) 3 6232 5118
fax (+61) 3 6232 5012
mob (+61) 438 315 623

l...@stat.uiowa.edu wrote:

Here is a more stripped down variant generates and error on OS X for
me:

 mkEg <- function(tm) list(scrunge = as.POSIXct(tm))

 extract <- function(db) {
e<- new.env()
lazyLoad(db, e)
as.list( e)
 }

 eg <- mkEg("2009-11-04 12:49:53")
 eg1 <- mkEg("2009-11-04 12:49:28")

 tools:::makeLazyLoadDB( eg, '/tmp/ll')
 extract('/tmp/ll') # force; OK

 tools:::makeLazyLoadDB( eg1, '/tmp/ll')
 extract('/tmp/ll')

Changing the second set of /tmp/ll makes the symptom go away.

I believe this comes down to unintended use of the lazyload mechanism
-- in particular it is not intended that a database be rewritten
after it has been loaded.  There is a chaching mechanism for improved
performance on slow file systems, and I believe what is happening is
that the new indices are being used to look in the old chached data.
There might be some merit in having lazyLoad call R_lazyLoadDBflush.

luke

On Tue, 3 Nov 2009, Seth Falcon wrote:


Hi,

On 11/3/09 6:51 PM, mark.braving...@csiro.au wrote:


file.copy( 'd:/temp/Rdiff.Rd', 'd:/temp/scrunge.Rd') # Rdiff.Rd
from 'tools' package source

eglist<- list( scrunge=parse_Rd(  'd:/temp/scrunge.Rd'))
tools:::makeLazyLoadDB( eglist, 'd:/temp/ll')
e<- new.env()
lazyLoad( 'd:/temp/ll', e)
as.list( e) # force; OK

eglist1<- list( scrunge=parse_Rd(  'd:/temp/Rdiff.Rd'))
tools:::makeLazyLoadDB( eglist1, 'd:/temp/ll')
e<- new.env()
lazyLoad( 'd:/temp/ll', e)
as.list( e) # Splat

It doesn't make any difference which file I process first; the error
comes the second time round.


If I adjust this example in terms of paths and run on OS X, I get the
following error on the second run:


as.list(e) # Splat

Error in as.list.environment(e) : internal error -3 in R_decompress1

I haven't looked further yet.

+ seth

__
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



--
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:  l...@stat.uiowa.edu
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

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


[Rd] bug in heatmap?

2009-11-05 Thread Ross Boylan
Using R 2.10 on WinXP
heatmap(mymap, Rowv=NA, Colv=NA)
with mymap values of
 0   1  2 3   4
0  NaN 0.0 0.00621118 0.000 NaN
10 0.0 0.01041667 0.125 NaN
20 0.004705882 0.02105263 0.333 NaN
30 0.004081633 0.0222 0.500   0
40 0.0 0.01923077 0.167 NaN
60 0.0 0. 0.000 NaN
10   0 0.002840909 0. 0.000 NaN
20   0 0.002159827 0.   NaN NaN
40 NaN 0.009433962 0.   NaN NaN
(the first row and column are labels, not data)
produces a plot in which all of the row labelled 6 (all 0's and NaN) is
white.  This is the same color showing for the NaN values.

In contrast, all other 0 values appear as dark red.

Have I missed some subtlety, or is this a bug?

Ross Boylan

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