GithubHelp home page GithubHelp logo

Usage of `@importFrom` about rawrr HOT 4 CLOSED

fgcz avatar fgcz commented on September 27, 2024
Usage of `@importFrom`

from rawrr.

Comments (4)

cpanse avatar cpanse commented on September 27, 2024

@tobiasko only relevant is what ends up in the NAMESPACE file
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Specifying-imports-and-exports
:: functions calls caused warning in the R CMD check in the past

from rawrr.

tobiasko avatar tobiasko commented on September 27, 2024

In the past? The golden age of Splus? ;-)

bash-3.2$ R CMD check rawrr
rawrr/ rawrr_0.1.7.tar.gz rawrr_0.2.0.tar.gz
bash-3.2$ R CMD check rawrr_0.2.0.tar.gz

  • using log directory ‘/Users/tobiasko/Documents/RStudio/rawrr.Rcheck’
  • using R version 4.0.2 (2020-06-22)
  • using platform: x86_64-apple-darwin17.0 (64-bit)
  • using session charset: UTF-8
  • checking for file ‘rawrr/DESCRIPTION’ ... OK
  • checking extension type ... Package
  • this is package ‘rawrr’ version ‘0.2.0’
  • package encoding: UTF-8
  • checking package namespace information ... OK
  • checking package dependencies ... OK
  • checking if this is a source package ... NOTE
    Found the following apparent object files/libraries:
    inst/rawrrassembly/bin/ThermoFisher.CommonCore.BackgroundSubtraction.dll
    inst/rawrrassembly/bin/ThermoFisher.CommonCore.Data.dll
    inst/rawrrassembly/bin/ThermoFisher.CommonCore.MassPrecisionEstimator.dll
    inst/rawrrassembly/bin/ThermoFisher.CommonCore.RawFileReader.dll
    Object files/libraries should not be included in a source package.
  • checking if there is a namespace ... OK
    *** checking for executable files ... WARNING**
    Found the following executable files:
    inst/rawrrassembly/bin/ThermoFisher.CommonCore.BackgroundSubtraction.dll
    inst/rawrrassembly/bin/ThermoFisher.CommonCore.Data.dll
    inst/rawrrassembly/bin/ThermoFisher.CommonCore.MassPrecisionEstimator.dll
    inst/rawrrassembly/bin/ThermoFisher.CommonCore.RawFileReader.dll
    inst/rawrrassembly/bin/rawrr.exe
    Source packages should not contain undeclared executable files.
    See section ‘Package structure’ in the ‘Writing R Extensions’ manual.
  • checking for hidden files and directories ... OK
  • checking for portable file names ... OK
  • checking for sufficient/correct file permissions ... OK
  • checking whether package ‘rawrr’ can be installed ... OK
  • checking installed package size ... OK
  • checking package directory ... OK
  • checking ‘build’ directory ... OK
  • checking DESCRIPTION meta-information ... OK
  • 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 dependencies in R code ... OK
  • 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 ... OK
  • checking Rd metadata ... OK
    *** checking Rd cross-references ... WARNING**
    Unbekanntes Paket ‘rawDiag’ in Rd Kreuzreferenzen
  • checking for missing documentation entries ... OK
  • checking for code/documentation mismatches ... OK
  • checking Rd \usage sections ... OK
  • checking Rd contents ... OK
  • checking for unstated dependencies in examples ... OK
  • checking installed files from ‘inst/doc’ ... OK
  • checking files in ‘vignettes’ ... NOTE
    Files named as vignettes but with no recognized vignette engine:
    ‘vignettes/JPR_supplement.Rmd’
    (Is a VignetteBuilder field missing?)
  • checking examples ... OK
  • checking for unstated dependencies in ‘tests’ ... OK
  • checking tests ...
    Running ‘testthat.R’
    OK
  • checking for unstated dependencies in vignettes ... OK
  • checking package vignettes in ‘inst/doc’ ... OK
  • checking running R code from vignettes ...
    ‘JPR_TechnicalNote.Rmd’ using ‘UTF-8’... OK
    NONE
  • checking re-building of vignette outputs ... OK
  • checking PDF version of manual ... OK
  • DONE

Status: 2 WARNINGs, 2 NOTEs
See
‘/Users/tobiasko/Documents/RStudio/rawrr.Rcheck/00check.log’
for details.

No warnings due to purrr::map_df(x, tabulateSpectrum, accNames). Maybe you didn't Import the package in the DESCRIPTION file?

from rawrr.

tobiasko avatar tobiasko commented on September 27, 2024

Hmmm...and reading this (from #Specifying-imports-and-export)

"If a package only needs a few objects from another package it can use a fully qualified variable reference in the code instead of a formal import. A fully qualified reference to the function f in package foo is of the form foo::f. This is slightly less efficient than a formal import and also loses the advantage of recording all dependencies in the NAMESPACE file (but they still need to be recorded in the DESCRIPTION file). Evaluating foo::f will cause package foo to be loaded, but not attached, if it was not loaded already—this can be an advantage in delaying the loading of a rarely used package."

Somehow reminds of what I copied above from the roxygen2 webside.

from rawrr.

tobiasko avatar tobiasko commented on September 27, 2024

Something related to roxygen tags and the NAMESPACE:

I would avoid the usage of @exportClass, since exporting classes is S4-specific (which makes total sense because there is not even a formal class definition in S3). As the roxygen2 docu says:

"S4 classes: If you want others to be able to extend your class, @export it. If you want others to create instances of your class, but not extend it, @export the constructor function, but not the class."

rawrr does not define any S4 classes, so there is nothing to export.

The tag @exportS3Method is not needed to get correct directives for S3 methods like plot.rawrrSpectrum. A simple @export tag in each method definition does the job. I removed all of these tags locally:

#' @export
## #' @export readChromatogram
## #' @exportClass rawrrChromatogram
## #' @exportClass rawrrChromatogramSet
## #' @exportS3Method plot rawrrChromatogram
## #' @exportS3Method plot rawrrChromatogramSet
#' @importFrom utils read.csv2
#' @examples

to arrive at a NAMESPACE like:

# Generated by roxygen2: do not edit by hand

S3method(plot,rawrrChromatogram)
S3method(plot,rawrrChromatogramSet)
S3method(plot,rawrrSpectrum)
S3method(print,rawrrSpectrum)
S3method(summary,rawrrChromatogram)
S3method(summary,rawrrSpectrum)
export(basePeak)
export(dependentScan)
export(faimsVoltageOn)
export(is.rawrrChromatogram)
export(is.rawrrSpectrum)
export(makeAccessor)
export(massRange)
export(masterScan)
export(rawrrSpectrum)
export(readChromatogram)
export(readFileHeader)
export(readIndex)
export(readSpectrum)
export(sampleFilePath)
export(scanNumber)
export(tic)
export(validate_rawrrIndex)
export(validate_rawrrSpectrum)
importFrom(grDevices,hcl.colors)
importFrom(graphics,legend)
importFrom(graphics,lines)
importFrom(graphics,text)
importFrom(stats,na.omit)
importFrom(utils,packageVersion)
importFrom(utils,read.csv2)
importFrom(utils,read.table)

All checks pass.

from rawrr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.