[Rd] Confusing inheritance problem

Therneau, Terry M., Ph.D. therneau at mayo.edu
Tue Jul 19 22:34:29 CEST 2011

 Yup, that fixes the problem.  This was also pointed out by Uwe in a personal
  One confusing aspect is that there are two test files in the skeleton package, one of 
which calls rowSums( a dsCMatrix object) at top level, and the other of which does the
same thing within a dispached method.  Only the second one fails.  An interesting puzzle, but not one I'll pursue with any vigor now that we have a fix.

Terry T.

-----Original Message-----
From: Hervé Pagès [mailto:hpages at fhcrc.org] 
Sent: Tuesday, July 19, 2011 2:54 PM
To: Therneau, Terry M., Ph.D.
Cc: r-devel at r-project.org
Subject: Re: [Rd] Confusing inheritance problem

Hi Terry,

You use a NAMESPACE but you don't import Matrix.
So it looks like the "rowSums" method for CsparseMatrix objects
cannot be found (not sure why because you do have Matrix in the
Depends field so the rowSums generic and methods should be in the
search path).

Anyway, just adding


to the NAMESPACE file solves the problem for me.


On 11-07-18 09:16 AM, Terry Therneau wrote:
>   I've packaged the test library up as a tar file at
> 	ftp.mayo.edu
> 	directory therneau, file ktest.tar
> 	login username: mayoftp
>               password:  KPlLiFoz
> This will disappear in 3 days (Mayo is very fussy about outside access).
> In response to Uwe's comments
>    1. "2.13.0" is not recent
>      It's not the latest, but it is recent.  This is for machines at work where
> where upgrades happen more infrequently
>    2. "Matrix not loaded"
> The sessionInfo was only to show what version we have.  Forgetting to load Matrix
> isn't the problem -- when I do that the error is quick and obvious.
>   Thanks in advance for any pointers.
> Terry T.
> On Sat, 2011-07-16 at 19:27 +0200, Uwe Ligges wrote:
>> On 15.07.2011 23:23, Terry Therneau wrote:
>>>    I have library in development with a function that works when called
>>> from the top level, but fails under R CMD check.  The paricular line of
>>> failure is
>>> 	rsum<- rowSums(kmat>0)
>>> where kmat is a dsCMatrix object.
>>>     I'm currently stumped and looking for some ideas.
>>>     I've created a stripped down library "ktest" that has only 3
>>> functions: pedigree.R to create a pedigree or pedigreeList object,
>>> 	   kinship.R with "kinship" methods for the two objects
>>> 	   one small compute function called by the others
>>> along with the minimal amount of other information such that a call to
>>>      R --vanilla CMD check ktest
>>> gives no errors until the fatal one.
>>>    There are two test cases.  A 3 line one that creates a dsCMatrix and
>>> call rowSums at the top level works fine, but the same call inside the
>>> kmat.pedigreeList function gives an error
>>>           'x' must be an array of at least two dimensions
>>> Adding a print statement above the rowSums call shows that the argument
>>> is a 14 by 14 dsCMatrix.
>>>    I'm happy to send the library to anyone else to try and duplicate.
>>>       Terry Therneau
>>> tmt% R --vanilla
>>>> sessionInfo()
>>> R version 2.13.0 (2011-04-13)
>>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>> locale:
>>>    [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>>    [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C
>>>    [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
>>>    [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>>>    [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>> attached base packages:
>>> [1] stats     graphics  grDevices utils     datasets  methods
>>> base
>> Terry,
>> 1. Your R is not recent.
>> 2. You do this without having Matrix loaded (according to
>> sessionInfo())? This may already be the cause of your problems.
>> 3. You may want to make your package available on some website. I am
>> sure there are people who will take a look (including me, but not today).
>> Best wishes,
>> Uwe
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

More information about the R-devel mailing list