In the little orientation data package I'm working on, the very first
example fails, even though the same code works when used in a regular
session. In my experience, this usually indicates T or F has been
used instead of TRUE or FALSE, but that's not the case this time.
The error message is
> x <- eulerzyx(1,0,0)
Error: Trying to get slot "validity" from an object of a basic class
("NULL") with no slots
Execution halted
What I think is the relevant source looks like this:
setClass('orientation')
setIs('orientation','vector')
setClass('eulerzyx', representation(x = 'matrix'))
setIs('eulerzyx', 'orientation')
eulerzyx <- function(psi, theta, phi)
new('eulerzyx', x = cbind(psi, theta, phi))
Can anyone tell me what that error message means? Is it something
I've done wrong, or a problem with the methods package or the checks?
Duncan Murdoch
Problem with Rcmd check and S4 methods
7 messages · Duncan Murdoch, John Chambers
Duncan Murdoch wrote:
In the little orientation data package I'm working on, the very first example fails, even though the same code works when used in a regular session. In my experience, this usually indicates T or F has been used instead of TRUE or FALSE, but that's not the case this time. The error message is
> x <- eulerzyx(1,0,0)4bb
Error: Trying to get slot "validity" from an object of a basic class
("NULL") with no slots
Execution halted
What I think is the relevant source looks like this:
setClass('orientation')
setIs('orientation','vector')
setClass('eulerzyx', representation(x = 'matrix'))
setIs('eulerzyx', 'orientation')
eulerzyx <- function(psi, theta, phi)
new('eulerzyx', x = cbind(psi, theta, phi))
Can anyone tell me what that error message means?
The code has a NULL object that was supposed to be a class definition (and therefore to have a "validity" slot).
Is it something I've done wrong, or a problem with the methods package or the checks?
I was able to add your source & the one-line example to a small package and get through R CMD check. Can you do example(eulerzyx) after attaching the package? Are you using a saved image (e.g., with an empty install.R file in the package directory)? (Though if not, the check would often fail at an earlier stage.) It would be nice to be able to get a dump from the R CMD check evaluation--maybe someone can suggest how. John
Duncan Murdoch
______________________________________________ R-devel@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
John M. Chambers jmc@bell-labs.com Bell Labs, Lucent Technologies office: (908)582-2681 700 Mountain Avenue, Room 2C-282 fax: (908)582-3340 Murray Hill, NJ 07974 web: http://www.cs.bell-labs.com/~jmc
On Fri, 13 Jun 2003 13:18:23 -0400, John Chambers wrote:
Duncan Murdoch wrote:
> x <- eulerzyx(1,0,0)4bb
Error: Trying to get slot "validity" from an object of a basic class
("NULL") with no slots
Execution halted
The code has a NULL object that was supposed to be a class definition (and therefore to have a "validity" slot).
I was able to add your source & the one-line example to a small package and get through R CMD check. Can you do example(eulerzyx) after attaching the package?
This is actually in the eulerzyx-class.Rd help file; I should have said that.
Are you using a saved image (e.g., with an empty install.R file in the package directory)? (Though if not, the check would often fail at an earlier stage.)
I don't think so... If you want to take a look, I've put the whole library (in its current incomplete state) online at <http://www.stats.uwo.ca/faculty/murdoch/temp/orientlib_1.0.tar.gz>, and the log from running the examples here: <http://www.stats.uwo.ca/faculty/murdoch/temp/orientlib-Ex.Rout>. Duncan Murdoch
On Fri, 13 Jun 2003 13:18:23 -0400, you wrote:
It would be nice to be able to get a dump from the R CMD check evaluation--maybe someone can suggest how.
If I just cut all the preamble from the Rout file and paste it into the console, I get the same error. Here's a traceback(), I'm not sure what you mean by a dump. Duncan
x <- eulerzyx(1,0,0)
Error: Trying to get slot "validity" from an object of a basic class
("NULL") with no slots
traceback()
5: validObject(.Object)
4: initialize(value, ...)
3: initialize(value, ...)
2: new("eulerzyx", x = cbind(psi, theta, phi))
1: eulerzyx(1, 0, 0)
Duncan Murdoch wrote:
On Fri, 13 Jun 2003 13:18:23 -0400, you wrote:
It would be nice to be able to get a dump from the R CMD check evaluation--maybe someone can suggest how.
If I just cut all the preamble from the Rout file and paste it into the console, I get the same error. Here's a traceback(), I'm not sure what you mean by a dump. Duncan
x <- eulerzyx(1,0,0)
Error: Trying to get slot "validity" from an object of a basic class
("NULL") with no slots
traceback()
5: validObject(.Object)
4: initialize(value, ...)
3: initialize(value, ...)
2: new("eulerzyx", x = cbind(psi, theta, phi))
1: eulerzyx(1, 0, 0)
I think the problem is from not using a saved image. Using your tar file, if I untar into orientlib/, I get the same error you report. But after creating the install.R file: guinan[RPackages]$ touch orientlib/install.R the error in this example goes away. (There is a later error:
x <- rotvector(matrix(c(1,0,0,0,1,0,0,0,1)))
Error: ncol(m) == 9 is not TRUE but I'm guessing this may be more local :-) Hopefully for 1.8 we will get rid of the differences between saved image and ordinary loading (except that the latter will still be slower for packages doing much with classes and methods). John
John M. Chambers jmc@bell-labs.com Bell Labs, Lucent Technologies office: (908)582-2681 700 Mountain Avenue, Room 2C-282 fax: (908)582-3340 Murray Hill, NJ 07974 web: http://www.cs.bell-labs.com/~jmc
On Fri, 13 Jun 2003 15:04:44 -0400, you wrote:
I think the problem is from not using a saved image. Using your tar file, if I untar into orientlib/, I get the same error you report. But after creating the install.R file:
Thanks, that fixed it. Perhaps the check script could try to determine if this was necessary?
guinan[RPackages]$ touch orientlib/install.R the error in this example goes away. (There is a later error:
x <- rotvector(matrix(c(1,0,0,0,1,0,0,0,1)))
Error: ncol(m) == 9 is not TRUE but I'm guessing this may be more local :-)
Yes :-). Duncan
Duncan Murdoch wrote:
On Fri, 13 Jun 2003 15:04:44 -0400, you wrote:
I think the problem is from not using a saved image. Using your tar file, if I untar into orientlib/, I get the same error you report. But after creating the install.R file:
Thanks, that fixed it. Perhaps the check script could try to determine if this was necessary?
It's a little tricky, and in any case the better solution is to ensure that the semantics are the same with or without the saved image. If it turns out that the time penalty for library(foo) with no saved image is very large when foo contains class/method code, we could give a warning at INSTALL time if a saved image is not created. Or perhaps make saved images the default? John
guinan[RPackages]$ touch orientlib/install.R the error in this example goes away. (There is a later error:
x <- rotvector(matrix(c(1,0,0,0,1,0,0,0,1)))
Error: ncol(m) == 9 is not TRUE but I'm guessing this may be more local :-)
Yes :-). Duncan
John M. Chambers jmc@bell-labs.com Bell Labs, Lucent Technologies office: (908)582-2681 700 Mountain Avenue, Room 2C-282 fax: (908)582-3340 Murray Hill, NJ 07974 web: http://www.cs.bell-labs.com/~jmc