Re: [Rd] S4 Inheritance of environments

2010-04-25 Thread Duncan Murdoch

On 24/04/2010 1:15 PM, Christopher Brown wrote:

I looked through the documentation and the mailing lists and could not
find an answer to this.  My apologies if it has already been answered.
 If it has, a pointer to the relevant discussion would be greatly
appreciated.
  


Environments are unusual in that they are reference objects:  if e is an 
environment, and you assign f - e, then f refers to the same object as 
e does.  This is unusual in R, where most objects are copied on 
assignment (logically, not always physically).  It means that attributes 
on environments behave strangely:  if you put an attribute on e and 
remove the same attribute from f, it is gone from e too.  We've 
discussed removing the possibility of putting attributes on environments 
(just as you can't put attributes on NULL), but haven't done so yet.


What you should do if you want to use an environment in the way you're 
using it is to put it in a container.  For S4, that could mean using an 
environment as a slot, or inheriting from an object like list(e), rather 
than directly from e.


Duncan Murdoch

Creating S4 classes containing environments exhibits unexpected
behavior/features.  These have a different in two ways:

1) slotName for the data: .xData instead of .Data and do not respond to the
2) Response to the is.* function seems to indicate that the object
does not know of its inheritance.  ( Notably, the inherits function
works as expected. )

Here is a working illustration:

  

#  LIST
setClass( 'inheritList', contains='list')


[1] inheritList
  

inList - new( 'inheritList' )
class( inList )


[1] inheritList
attr(,package)
[1] .GlobalEnv
  

is.list( inList )  # TRUE


[1] TRUE
  

slotNames(inList)  # .Data


[1] .Data
  

inherits(inList, 'list' )  # TRUE


[1] TRUE
  

# ENVIRONMENT
setClass( 'inheritEnv', contains='environment' )


Defining type environment as a superclass via class .environment
[1] inheritEnv
  

inEnv - new( 'inheritEnv' )
class(inEnv)


[1] inheritEnv
attr(,package)
[1] .GlobalEnv
  

is.environment(inEnv) # FALSE


[1] FALSE
  

slotNames(inEnv)  # .xData


[1] .xData
  

inherits(inEnv, 'environment' )   # TRUE


[1] TRUE

My questions is whether this behavior is a bug? By design?  A work
around?  Etc.?

Thanks kindly for your reply,

Chris


the Open Data Group
 http://www.opendatagroup.com
 http://blog.opendatagroup.com

__
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] S4 Inheritance of environments

2010-04-25 Thread Henrik Bengtsson
On Sun, Apr 25, 2010 at 1:09 PM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
 On 24/04/2010 1:15 PM, Christopher Brown wrote:

 I looked through the documentation and the mailing lists and could not
 find an answer to this.  My apologies if it has already been answered.
  If it has, a pointer to the relevant discussion would be greatly
 appreciated.


 Environments are unusual in that they are reference objects:  if e is an
 environment, and you assign f - e, then f refers to the same object as e
 does.  This is unusual in R, where most objects are copied on assignment
 (logically, not always physically).  It means that attributes on
 environments behave strangely:  if you put an attribute on e and remove the
 same attribute from f, it is gone from e too.  We've discussed removing the
 possibility of putting attributes on environments (just as you can't put
 attributes on NULL), but haven't done so yet.

 What you should do if you want to use an environment in the way you're using
 it is to put it in a container.  For S4, that could mean using an
 environment as a slot, or inheriting from an object like list(e), rather
 than directly from e.

I can confirm these reported issues.  FYI, what Duncan is suggesting
is exactly the design behind the Object class (encapsulates an
environment) in the R.oo package.  The difference is that it is
working with S3.  It's been working flawlessly for  9 years.  Others
have had idea to do the same but with S4, but I'm not sure if that
ever took of.

/Henrik
(R.oo author)

 Duncan Murdoch

 Creating S4 classes containing environments exhibits unexpected
 behavior/features.  These have a different in two ways:

 1) slotName for the data: .xData instead of .Data and do not respond
 to the
 2) Response to the is.* function seems to indicate that the object
 does not know of its inheritance.  ( Notably, the inherits function
 works as expected. )

 Here is a working illustration:



 #  LIST
 setClass( 'inheritList', contains='list')


 [1] inheritList


 inList - new( 'inheritList' )
 class( inList )


 [1] inheritList
 attr(,package)
 [1] .GlobalEnv


 is.list( inList )          # TRUE


 [1] TRUE


 slotNames(inList)          # .Data


 [1] .Data


 inherits(inList, 'list' )  # TRUE


 [1] TRUE


 # ENVIRONMENT
 setClass( 'inheritEnv', contains='environment' )


 Defining type environment as a superclass via class .environment
 [1] inheritEnv


 inEnv - new( 'inheritEnv' )
 class(inEnv)


 [1] inheritEnv
 attr(,package)
 [1] .GlobalEnv


 is.environment(inEnv)             # FALSE


 [1] FALSE


 slotNames(inEnv)                  # .xData


 [1] .xData


 inherits(inEnv, 'environment' )   # TRUE


 [1] TRUE

 My questions is whether this behavior is a bug? By design?  A work
 around?  Etc.?

 Thanks kindly for your reply,

 Chris


 the Open Data Group
  http://www.opendatagroup.com
  http://blog.opendatagroup.com

 __
 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] Miktex does not work with R CMD check

2010-04-25 Thread Ulrike Grömping

Dear DevelopeRs,

the issue I am stuck with (I am on Windows, R-2.11): My Miktex (version 
2.8) does not work with R CMD check, although Miktex on its own can 
pdflatex the tex-file in the Rcheck directory. (This issue has been 
going on for a while, and now, after having updated to R-2.11, I finally 
want to get it fixed.) Although I have found several similar posts, none 
of the answers appears to solve my problem, which seems to be 
path-related. In case it is relevant: in the past, I did have issues 
with paths to my documents because these contain a German Umlaut on my 
computer, which is why I moved all R packages to the directory c:/rtests.


I would appreciate any help on this issue. The relevant portion of R CMD 
check and the content of Rdlatex.log are included below.


Best regards,
Ulrike

The end of the R CMD check output looks like this:

* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.
* checking PDF version of manual without index ... ERROR
LaTeX error when running command:
 Rcmd.exe Rd2dvi --batch --no-preview --pdf
   --build-dir=C:/WINDOWS/Temp/Rd2dvi611638299 --no-clean --no-index -o
   DoE.base-manual.pdf /dev/null 21 C:/rtests/DoE.base.Rcheck/DoE.base
Re-running with no redirection of stdout/stderr.

The file Rdlatex.log contains the following text:

Hmm ... looks like a package
latex.exe: A required file system path could not be retrieved.
latex.exe: Data: 28
Creating pdf output from LaTeX ...
pdflatex.exe: A required file system path could not be retrieved.
pdflatex.exe: Data: 28
Error in running pdflatex command ('pdflatex')
You may want to clean up by 'rm -rf C:/WINDOWS/Temp/Rd2dvi611638299'

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


Re: [Rd] Question of R CMD check

2010-04-25 Thread rusers.sh
Hi all,
  I find the problem.See below.
  Today, i installed the newest R-VERSION2.11.0 for checking. Different
error occurred. I checked the log and found 'Hmisc' package caused this. At
present, binary package was not provided. After i installed an old version
of 'Hmisc' package, it works very well.
  I think there should be no problem for R. It may be caused by
the dependent  package 'Hmisc' that has no newest binary package in the
CRAN. Sorry about this.

2010/4/23 rusers.sh rusers...@gmail.com

 Hi Duncan,
   Enclosed is the example package and the checking results. No rm() or
 remove() in the example. Before this re-installation of  R and other tools
 (e.g. Rtools), there are no errors for package checking.
   Thanks.


 2010/4/23 Duncan Murdoch murdoch.dun...@gmail.com

 On 23/04/2010 1:19 PM, rusers.sh wrote:

 Hi Duncan,
  Thanks for reminding me. See below for the error information from *.Rout
 file
  It seems that 'pkgname' was not found. I am not sure whether there is
 some
 problem with my functions or it is a little bug.
  Thanks a lot.
 ###


 assign(ptime, proc.time(), pos = CheckExEnv)
 ## at least one package changes these via ps.options(), so do this
 ## before loading the package.
 ## Use postscript as incomplete files may be viewable, unlike PDF.
 ## Choose a size that is close to on-screen devices, fix paper
 grDevices::ps.options(width = 7, height = 7, paper = a4, reset = TRUE)
 grDevices::postscript(paste(pkgname, -Ex.ps, sep=))


 Error in paste(pkgname, -Ex.ps, sep = ) : object 'pkgname' not found
 Calls: Anonymous - checkIntFormat - gsub - paste
 Execution halted



 The very first line of stam-Ex.R should be

 pkgname - stam

 Is it?  If not, I'd like to see the package; could you send me a copy?  If
 it is, then something in one of your examples is messing with it.  Do you
 have any calls to rm() or remove() in your examples?

 Duncan Murdoch

  2010/4/23 Duncan Murdoch murdoch.dun...@gmail.com



 On 21/04/2010 9:48 PM, rusers.sh wrote:



 Hi all,
   Today, i just installed the newest R version 2.10.1 and other
 necessary
 tools for building R package under windows,e.g. Rtools, perl. All are
 the
 newest version.
  After the correct configuration under windows (configuration should be
 correct), i use it to re-check my old package. I found the following
 prolem
 when checking EXAMPLEs in each function, which did not exist before
 this
 re-installation.
 
 * checking examples ... ERROR
  Running examples in 'stam-Ex.R' failed.
 
  I used \dontrun{} % enddontrun in all the examples of my functions
 that
 should be no problem, i think. I checked my package before and did not
 find
 errors. I also browsed the checking results in 'stam-Ex.R'. It listed
 all
 the example codes in that file, something like this,
  cleanEx(); nameEx(stcdt)
  ### * stcdt
  flush(stderr()); flush(stdout())
  ###example codes

  I did not met this problem before.  Any ideas on solving this?
  Thanks a lot.





 You need to show us the end of the stam-Ex.Rout file.  It will contain
 the
 error message.

 Duncan Murdoch












 --
 -
 Jane Chang
 Queen's




-- 
-
Jane Chang
Queen's

[[alternative HTML version deleted]]

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


[Rd] problem with Rcmdr Plugins

2010-04-25 Thread Hodgess, Erin
Dear R Development People:

I have written a couple of plugins for Rcmdr and they do not seem to work with 
R-2.11.0.

Here is the output:
 library(RcmdrPlugin.epack)
Loading required package: Rcmdr
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Loading required package: car
--- Please select a CRAN mirror for use in this session ---

Rcmdr Version 1.5-4


Attaching package: 'Rcmdr'

The following object(s) are masked from 'package:tcltk':

tclvalue

Loading required package: rgl
Loading required package: TeachingDemos
Loading required package: tseries
Loading required package: quadprog
Loading required package: zoo

'tseries' version: 0.10-22

'tseries' is a package for time series analysis and computational
finance.

See 'library(help=tseries)' for details.

Loading required package: abind
Loading required package: MASS
Error : package 'rgl' is required by 'RcmdrPlugin.epack' so will not be detached
Error in library(RcmdrPlugin.epack) : 
  .First.lib failed for 'RcmdrPlugin.epack'
 

This is on a Windows XP.  I'm downloading the Rcmdr requirements on a Linux 
machine as we speak.

Have you run into this please?
Thanks,
Erin


Erin M. Hodgess, PhD
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: hodge...@uhd.edu


[[alternative HTML version deleted]]

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


[Rd] a side note to the Rcmdr issue

2010-04-25 Thread Hodgess, Erin
Hi again.

On Windows, when I try to use the install packages from the menu, there is no 
Rcmdr and no RcmdrPlugins to be seen.

thanks,
Erin


Erin M. Hodgess, PhD
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: hodge...@uhd.edu


[[alternative HTML version deleted]]

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


Re: [Rd] a side note to the Rcmdr issue

2010-04-25 Thread John Fox
Dear Erin,

Unlike in previous version of R for Windows, the package list is
alphabetized with uppercase letters preceding lowercase letters. Thus look
under uppercase R and then lowercase c.

Regards,
 John


John Fox
Senator William McMaster 
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


 -Original Message-
 From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org]
On
 Behalf Of Hodgess, Erin
 Sent: April-25-10 2:56 PM
 To: r-devel@r-project.org
 Subject: [Rd] a side note to the Rcmdr issue
 
 Hi again.
 
 On Windows, when I try to use the install packages from the menu, there
is
 no Rcmdr and no RcmdrPlugins to be seen.
 
 thanks,
 Erin
 
 
 Erin M. Hodgess, PhD
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: hodge...@uhd.edu
 
 
   [[alternative HTML version deleted]]
 
 __
 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] problem with Rcmdr Plugins

2010-04-25 Thread John Fox
Dear Erin,

I'm not sure why this is a problem with R 2.11.0 and not with earlier
versions (I'm sure that someone else will be able to answer), but it is
unnecessary for your plug-in package to require rgl, since rgl is already
loaded by the Rcmdr package at startup if it is present. The same is true of
tseries, abind, and MASS.

I hope this helps,
 John


John Fox
Senator William McMaster 
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


 -Original Message-
 From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org]
On
 Behalf Of Hodgess, Erin
 Sent: April-25-10 2:48 PM
 To: r-devel@r-project.org
 Subject: [Rd] problem with Rcmdr Plugins
 
 Dear R Development People:
 
 I have written a couple of plugins for Rcmdr and they do not seem to work
 with R-2.11.0.
 
 Here is the output:
  library(RcmdrPlugin.epack)
 Loading required package: Rcmdr
 Loading required package: tcltk
 Loading Tcl/Tk interface ... done
 Loading required package: car
 --- Please select a CRAN mirror for use in this session ---
 
 Rcmdr Version 1.5-4
 
 
 Attaching package: 'Rcmdr'
 
 The following object(s) are masked from 'package:tcltk':
 
 tclvalue
 
 Loading required package: rgl
 Loading required package: TeachingDemos
 Loading required package: tseries
 Loading required package: quadprog
 Loading required package: zoo
 
 'tseries' version: 0.10-22
 
 'tseries' is a package for time series analysis and computational
 finance.
 
 See 'library(help=tseries)' for details.
 
 Loading required package: abind
 Loading required package: MASS
 Error : package 'rgl' is required by 'RcmdrPlugin.epack' so will not be
 detached
 Error in library(RcmdrPlugin.epack) :
   .First.lib failed for 'RcmdrPlugin.epack'
 
 
 This is on a Windows XP.  I'm downloading the Rcmdr requirements on a
Linux
 machine as we speak.
 
 Have you run into this please?
 Thanks,
 Erin
 
 
 Erin M. Hodgess, PhD
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: hodge...@uhd.edu
 
 
   [[alternative HTML version deleted]]
 
 __
 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] S4 Inheritance of environments

2010-04-25 Thread John Chambers
In addition to Duncan Murdoch's explanation, this is discussed in the 
documentation for Classes (briefly):

.

Extending a basic type this way allows objects to use old-style code for 
the corresponding type as well as S4 methods. Any basic type can be used 
for .Data, but a few types are treated differently because they do not 
behave like ordinary objects; for example, NULL, environments, and 
external pointers. Classes extend these types by using a specially named 
slot, itself inherited from an internally defined S4 class. Inheritance 
from the nonstandard object type then requires an actual computation, 
rather than the simple inclusion for other types and classes. The 
intent is that programmers will not need to take account of the 
mechanism, but one implication is that you should not explicitly use the 
type of an S4 object that extends an arbitrary object type. Use is and 
similar functions instead.


...


The code for is.environment() is presumably using the type, whereas 
inherits() takes account of the indirect mechanism.


Generally, you should be able to deal with inheritance from environments 
in a natural way.


John


On 4/24/10 10:15 AM, Christopher Brown wrote:

I looked through the documentation and the mailing lists and could not
find an answer to this.  My apologies if it has already been answered.
  If it has, a pointer to the relevant discussion would be greatly
appreciated.

Creating S4 classes containing environments exhibits unexpected
behavior/features.  These have a different in two ways:

1) slotName for the data: .xData instead of .Data and do not respond to the
2) Response to the is.* function seems to indicate that the object
does not know of its inheritance.  ( Notably, the inherits function
works as expected. )

Here is a working illustration:


#  LIST
setClass( 'inheritList', contains='list')

[1] inheritList

inList- new( 'inheritList' )
class( inList )

[1] inheritList
attr(,package)
[1] .GlobalEnv

is.list( inList )  # TRUE

[1] TRUE

slotNames(inList)  # .Data

[1] .Data

inherits(inList, 'list' )  # TRUE

[1] TRUE



# ENVIRONMENT
setClass( 'inheritEnv', contains='environment' )

Defining type environment as a superclass via class .environment
[1] inheritEnv

inEnv- new( 'inheritEnv' )
class(inEnv)

[1] inheritEnv
attr(,package)
[1] .GlobalEnv

is.environment(inEnv) # FALSE

[1] FALSE

slotNames(inEnv)  # .xData

[1] .xData

inherits(inEnv, 'environment' )   # TRUE

[1] TRUE

My questions is whether this behavior is a bug? By design?  A work
around?  Etc.?

Thanks kindly for your reply,

Chris


the Open Data Group
  http://www.opendatagroup.com
  http://blog.opendatagroup.com

__
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