Error in spca() could not find function "spca" Execution halted

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in spca() could not find function "spca" Execution halted

bobbiedigital
HI,

I'm trying to write a package in S4 R for submission to bioconductor.  I understand that I could submit this question to bioconductor but since this is being written in R S4 without any use of specific bioconductor packages I thought this would be the best place? Sorry if I am wrong.. I'm familiar with OOP in other languages and I am coming to terms with OOP in R. I am newish to R and definitely new to writing in S4, so any help would be greatly appreciated!

I am running a test program and I am getting the following error.
Error in spca(X.nutri, ncomp = 3, center = TRUE, scale = TRUE, keepX = c(10,  :
  could not find function "spca"
Execution halted

My NAMESPACE file is like this.

import(MASS, lattice, igraph, ggplot2, corpcor, parallel, RColorBrewer, plyr)

importFrom("graphics", "barplot")
importFrom("stats", "var")
importFrom("stats", "na.omit")
importFrom("utils", "relist")

exportClasses("pca", "wrapper", "spca")
export(tune.pca, pca, spca, withinVariation, explained_variance)t)
exportMethods(logratio.transfo, pca, spca)

My Description file as such

Package: name
Type: bioPAckage
Title: Title
Version: 0.0.1
Date: 02/05/2017
Author: Bobbie Shaban
Maintainer: Bobbie Shaban <email>
Depends: R (>= 3.3.0), MASS, lattice, ggplot2
Imports: igraph, rgl, ellipse, corpcor, RColorBrewer, plyr, dplyr, tidyr, reshape2, methods, parallel
Suggests: knitr
Collate: AllClasses.R AllGenerics.R functions.R nipals.R tune.pca.R spca.R pca.R wrapper.ilr.R withinVariation.R explained_variance.R check_entry.R nearZeroVar.R
VignetteBuilder: knitr
Description: TBA
URL: TBA
License: GPL (>= 2)
Packaged: TBA
Repository: Bioconductor
Date/Publication: TBA
NeedsCompilation: no
LazyLoad: yes

I've set the class in AllClasses.R
setClass("spca", representation( x="data.frame", ncomp="numeric", center="logical", scale="logical", keepX="vector", max.iter="numeric", tol="numeric", logratio="character", ilr.offset="numeric", multilevel="logical"))

I've set the generic
setGeneric("spca", function(x, ...) standardGeneric("spca"))

I've set the spca.R
setMethod(f="spca", signature="spca", function(x, ncomp=2, center=TRUE, scale=TRUE, keepX=rep(ncol(X), ncomp), max.iter=500, tol=1e-06, logratio = "none", ilr.offset=0.001, multilevel=NULL)

{
...do stuff
})

My R CMD check only produces a couple of documentation warnings
<raw>
root@6992eaa414aa:/home/bio# R CMD check bioPAckage
Bioconductor version 3.5 (BiocInstaller 1.26.0), ?biocLite for help
Bioconductor does not yet support R version 3.5.0
* using log directory ‘/home/bio/bioPAckage.Rcheck’
* using R Under development (unstable) (2017-04-29 r72639)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘bioPAckage/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘bioPAckage’ version ‘0.0.1’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘bioPAckage’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... NOTE
Malformed Description field: should contain one or more complete sentences.
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... NOTE
Namespaces in Imports field not imported from:
  ‘dplyr’ ‘ellipse’ ‘methods’ ‘reshape2’ ‘rgl’ ‘tidyr’
  All declared Imports should be used.
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
prepare_Rd: bioPAckage.Rd:22-23: Dropping empty section \references
prepare_Rd: bioPAckage.Rd:28-29: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... WARNING
Unknown package ‘<pkg>’ in Rd xrefs
* checking for missing documentation entries ... WARNING
Undocumented code objects:
  ‘explained_variance’ ‘logratio.transfo’ ‘pca’ ‘spca’ ‘tune.pca’
  ‘withinVariation’
Undocumented data sets:
  ‘Koren.16S’ ‘breast.TCGA’ ‘breast.tumors’ ‘diverse.16S’ ‘linnerud’
  ‘liver.toxicity’ ‘multidrug’ ‘nutrimouse’ ‘srbct’ ‘stemcells’ ‘vac18’
  ‘vac18.simulated’ ‘yeast’
Undocumented S4 classes:
  ‘pca’ ‘wrapper’ ‘spca’
Undocumented S4 methods:
  generic 'logratio.transfo' and siglist 'wrapper'
  generic 'pca' and siglist 'pca'
  generic 'spca' and siglist 'spca'
All user-level objects in a package (including S4 classes and methods)
should have documentation entries.
See chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking examples ... NONE
* checking PDF version of manual ... OK
* DONE

Status: 2 WARNINGs, 3 NOTEs
See
  ‘/home/bio/bioPAckage.Rcheck/00check.log’
for details.

The build is fine,
* checking for file ‘bioPAckage/DESCRIPTION’ ... OK
* preparing ‘bioPAckage’:
* checking DESCRIPTION meta-information ... OK
* installing the package to process help pages
* saving partial Rd database
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a ‘data/datalist’ file should be added
* building ‘bioPAckage.tar.gz’

But when I run the test script I get the following error.
Loading required package: MASS
Loading required package: lattice
Loading required package: ggplot2
Error in spca(X.nutri, ncomp = 3, center = TRUE, scale = TRUE, keepX = c(10,  :
  could not find function "spca"
Execution halted

Anyhelp would be greatly appreciated!
thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Error in spca() could not find function "spca" Execution halted

bobbiedigital
Bump up due to spam
Reply | Threaded
Open this post in threaded view
|

Re: Error in spca() could not find function "spca" Execution halted

bobbiedigital
Ok, well I got that working.

I am running into another error.

Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘pca.test’ for signature ‘"missing"’

I couldn't find anything on google, does any one know what this means?

Thanks,