[Rd] Use of Matrix within packages in R-2.14.0

Bryan W. Lewis blewis at illposed.net
Sat Nov 12 01:12:53 CET 2011


Dear R-devel readers:

  I am really stuck trying resolving an issue with the use of the
Matrix in one of my packages, irlba, with R-2.14.0. When I use
crossprod with at least one sparse argument in the packaged code I
receive the error:

Error in crossprod(x, y) :
  requires numeric/complex matrix/vector arguments

However, when I run the code outside of the context of the package it
works fine.

I have constructed the following trivial dummy package to replicate
the problem, the contents of which follow:

DESCRIPTION file:
Package: dummy
Type: Package
Title: Dummy package for testing
Version: 0.0.0
Date: 2011-10-15
Author: B. W. Lewis <blewis at illposed.net>
Maintainer: B. W. Lewis <blewis at illposed.net>
Description: A bogus test package
Depends: Matrix
License: GPL

NAMESPACE file:
export("test")

R/test.R file:
`test` <- function(A)
{
  x = crossprod(A)
  return(0)
}


To replicate the problem, create a package called "dummy" from the
above three files, install it, and run from R-2.14.0:

library("dummy")
A = Matrix(0,10,10)
test(A)

I have tested this with Ubuntu 10.10 GNU/Linux (64-bit), and 32-bit
Windows versions of R-2.14.0.

Any help in resolving this issue is greatly appreciated!

Thanks,

Bryan



More information about the R-devel mailing list