nickmckay / LiPD-utilities

Input/output and manipulation utilities for LiPD files in Matlab, R and Python
http://nickmckay.github.io/LiPD-utilities/
GNU General Public License v2.0
29 stars 9 forks source link

Get lipdR hosted on CRAN #48

Open chrismheiser opened 5 years ago

chrismheiser commented 5 years ago

This package needs a lot of work to pass CRAN standards. A lot of it is documentation issues, and some of it is more problematic like not being able to alter the global environment. This has a large effect on extractTs and collapseTs, and using bagit scripts in saveLiPD.


Updating lipdR documentation
Loading lipdR
Setting env vars --------------------------------------------------------------------------------------------------------------
CFLAGS  : -Wall -pedantic
CXXFLAGS: -Wall -pedantic
Building lipdR ----------------------------------------------------------------------------------------------------------------
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD build  \
  '/Users/cmh553/Documents/GitHub/LiPD-utilities/R' --no-resave-data --no-manual 

* checking for file ‘/Users/cmh553/Documents/GitHub/LiPD-utilities/R/DESCRIPTION’ ... OK
* preparing ‘lipdR’:
* checking DESCRIPTION meta-information ... OK
* excluding invalid files
Subdirectory 'R' contains invalid file names:
  ‘log’ ‘start’
Warning in as.POSIXlt.POSIXct(x, tz) :
  unknown timezone 'zone/tz/2019a.1.0/zoneinfo/America/Los_Angeles'
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building ‘lipdR_0.2.3.tar.gz’
Warning: invalid uid value replaced by that for user 'nobody'
Warning: invalid gid value replaced by that for user 'nobody'

Setting env vars --------------------------------------------------------------------------------------------------------------
_R_CHECK_CRAN_INCOMING_ : FALSE
_R_CHECK_FORCE_SUGGESTS_: FALSE
Checking lipdR ----------------------------------------------------------------------------------------------------------------
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD check  \
  '/var/folders/4n/fj7hr5fd2yj7_xbcj7r_yb40knt4y3/T//Rtmpp7Voe5/lipdR_0.2.3.tar.gz' --as-cran --timings --no-manual 

Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
  unknown timezone 'zone/tz/2019a.1.0/zoneinfo/America/Los_Angeles'
* using log directory ‘/private/var/folders/4n/fj7hr5fd2yj7_xbcj7r_yb40knt4y3/T/Rtmpp7Voe5/lipdR.Rcheck’
* using R version 3.3.3 (2017-03-06)
* using platform: x86_64-apple-darwin13.4.0 (64-bit)
* using session charset: UTF-8
* using options ‘--no-manual --as-cran’
* checking for file ‘lipdR/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘lipdR’ version ‘0.2.3’
* 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 ... NOTE
Found the following hidden files and directories:
  tests/.RData
These were most likely included in error. See section ‘Package
structure’ in the ‘Writing R Extensions’ manual.
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘lipdR’ 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 ... NOTE
Non-standard file/directory found at top level:
  ‘log’
* 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 ... WARNING
'::' or ':::' import not declared from: ‘geoChronR’
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... NOTE
download_from_url: no visible global function definition for
  ‘download.file’
put_base_data: no visible binding for global variable ‘L’
unzipper: no visible global function definition for ‘unzip’
update_lipd_v1_3_keys: no visible global function definition for
  ‘setNames’
validate_parameters: no visible binding for global variable ‘d’
write_csv_to_file: no visible global function definition for
  ‘write.table’
zipper: no visible global function definition for ‘zip’
Undefined global functions or variables:
  L d download.file setNames unzip write.table zip
Consider adding
  importFrom("stats", "setNames")
  importFrom("utils", "download.file", "unzip", "write.table", "zip")
to your NAMESPACE file.

Found the following assignments to the global environment:
File ‘lipdR/R/bag.R’:
  assign("bagit.script", bagit.script, envir = .GlobalEnv)
  assign("bagit.script", bagit.script, envir = .GlobalEnv)
  assign("bagit.script", "none", envir = .GlobalEnv)
  assign("bagit.script", "none", envir = .GlobalEnv)
File ‘lipdR/R/timeseries_extract.R’:
  assign("TMP_ts_storage", tmp_storage, envir = .GlobalEnv)
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd line widths ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... WARNING
Undocumented code objects:
  ‘test_extractTs’ ‘test_extractTsCorrectCount’
  ‘test_extractTsUniqueTsids’ ‘test_lipdread’
All user-level objects in a package should have documentation entries.
See chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.
* checking for code/documentation mismatches ... WARNING
Codoc mismatches from documentation object 'collapseTs':
collapseTs
  Code: function(ts, force = FALSE)
  Docs: function(ts)
  Argument names in code not in docs:
    force

Codoc mismatches from documentation object 'filterTs':
filterTs
  Code: function(ts, expression, exact = FALSE)
  Docs: function(ts, expression)
  Argument names in code not in docs:
    exact

Codoc mismatches from documentation object 'queryTs':
queryTs
  Code: function(ts, expression, exact = FALSE)
  Docs: function(ts, expression)
  Argument names in code not in docs:
    exact

Codoc mismatches from documentation object 'writeLipd':
writeLipd
  Code: function(D, path = NULL, ignore.warnings = FALSE)
  Docs: function(D, path)
  Argument names in code not in docs:
    ignore.warnings
  Mismatches in argument default values:
    Name: 'path' Code: NULL Docs: 

* checking Rd \usage sections ... WARNING
Undocumented arguments in documentation object 'build_structure'
  ‘d’ ‘pc’ ‘table_type’ ‘pcNumber’ ‘modelNumber’ ‘tableNumber’
Duplicated \argument entries in documentation object 'build_structure':
  ‘char’ ‘num’ ‘num’
Documented arguments not in \usage in documentation object 'build_structure':
  ‘list’ ‘char’ ‘num’

Documented arguments not in \usage in documentation object 'collapseTs':
  ‘force’

Undocumented arguments in documentation object 'collapse_block'
  ‘entry’ ‘l’ ‘key’ ‘pc’
Duplicated \argument entries in documentation object 'collapse_block':
  ‘list’
Documented arguments not in \usage in documentation object 'collapse_block':
  ‘list’ ‘char’

Undocumented arguments in documentation object 'collapse_block_indexed'
  ‘entry’ ‘l’ ‘key’
Duplicated \argument entries in documentation object 'collapse_block_indexed':
  ‘list’ ‘list’
Documented arguments not in \usage in documentation object 'collapse_block_indexed':
  ‘list’ ‘char’

Undocumented arguments in documentation object 'collapse_column'
  ‘table’ ‘entry’ ‘pc’
Duplicated \argument entries in documentation object 'collapse_column':
  ‘list’
Documented arguments not in \usage in documentation object 'collapse_column':
  ‘list’ ‘char’

Undocumented arguments in documentation object 'collapse_table'
  ‘d’ ‘entry’ ‘pc’
Duplicated \argument entries in documentation object 'collapse_table':
  ‘list’
Documented arguments not in \usage in documentation object 'collapse_table':
  ‘list’ ‘char’

Undocumented arguments in documentation object 'collapse_table_root'
  ‘table’ ‘entry’ ‘pc’
Duplicated \argument entries in documentation object 'collapse_table_root':
  ‘list’
Documented arguments not in \usage in documentation object 'collapse_table_root':
  ‘list’ ‘char’

Documented arguments not in \usage in documentation object 'filterTs':
  ‘exact’

Undocumented arguments in documentation object 'get_table'
  ‘d’ ‘current’ ‘pc’
Duplicated \argument entries in documentation object 'get_table':
  ‘list’
Documented arguments not in \usage in documentation object 'get_table':
  ‘list’ ‘char’

Undocumented arguments in documentation object 'put_base_data'
  ‘entry’ ‘raw_datasets’ ‘dsn’ ‘force’ ‘mode’
Duplicated \argument entries in documentation object 'put_base_data':
  ‘char’
Documented arguments not in \usage in documentation object 'put_base_data':
  ‘list’ ‘char’ ‘bool’

Undocumented arguments in documentation object 'put_table'
  ‘d’ ‘current’ ‘pc’ ‘table’
Duplicated \argument entries in documentation object 'put_table':
  ‘list’ ‘list’
Documented arguments not in \usage in documentation object 'put_table':
  ‘list’ ‘char’

Documented arguments not in \usage in documentation object 'queryTs':
  ‘exact’

Undocumented arguments in documentation object 'rm_existing_tables'
  ‘d’ ‘pc’ ‘whichtables’
Duplicated \argument entries in documentation object 'rm_existing_tables':
  ‘char’
Documented arguments not in \usage in documentation object 'rm_existing_tables':
  ‘list’ ‘char’

Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.
* checking Rd contents ... WARNING
Argument items with no description in Rd object 'lumpTsMetaVariables':
  ‘Ts’ ‘sc’

* checking for unstated dependencies in examples ... WARNING
Warning: parse error in file 'lipdR-Ex.R':
60:6: unexpected '['
59: # Time series
60: ts = [
         ^
* checking examples ... ERROR
Running examples in ‘lipdR-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: collapseTs
> ### Title: Collapse time series into LiPD dataset form
> ### Aliases: collapseTs
> 
> ### ** Examples
> 
> D <- readLipds()
Error: could not find function "readLipds"
Execution halted
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘testthat.R’
 ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
  [1] "Time Series has unique TSids"
  ── 1. Failure: Time Series has unique TSids (@test_lipdr.R#28)  ────────────────────────────────────────────────────────────────
  test_extractTsUniqueTsids("./Carre.Saloum.2018.lpd") not equal to 0.
  1/1 mismatches
  [1] -1 - 0 == -1

  [1] "LiPD Write: v1.3 with all table types"
  [1] "Filter Time Series"
  [1] "Query Time Series"
  ══ testthat results  ═══════════════════════════════════════════════════════════════════════════════════════════════════════════
  OK: 4 SKIPPED: 3 FAILED: 1
  1. Failure: Time Series has unique TSids (@test_lipdr.R#28) 

  Error: testthat unit tests failed
  Execution halted
* DONE

Status: 2 ERRORs, 6 WARNINGs, 4 NOTEs
See
  ‘/private/var/folders/4n/fj7hr5fd2yj7_xbcj7r_yb40knt4y3/T/Rtmpp7Voe5/lipdR.Rcheck/00check.log’
for details.

R CMD check results
2 errors | 6 warnings | 4 notes
checking examples ... ERROR
Running examples in ‘lipdR-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: collapseTs
> ### Title: Collapse time series into LiPD dataset form
> ### Aliases: collapseTs
> 
> ### ** Examples
> 
> D <- readLipds()
Error: could not find function "readLipds"
Execution halted

checking tests ... ERROR
  Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
  [1] "Time Series has unique TSids"
  ── 1. Failure: Time Series has unique TSids (@test_lipdr.R#28)  ────────────────────────────────────────────────────────────────
  test_extractTsUniqueTsids("./Carre.Saloum.2018.lpd") not equal to 0.
  1/1 mismatches
  [1] -1 - 0 == -1

  [1] "LiPD Write: v1.3 with all table types"
  [1] "Filter Time Series"
  [1] "Query Time Series"
  ══ testthat results  ═══════════════════════════════════════════════════════════════════════════════════════════════════════════
  OK: 4 SKIPPED: 3 FAILED: 1
  1. Failure: Time Series has unique TSids (@test_lipdr.R#28) 

  Error: testthat unit tests failed
  Execution halted

checking dependencies in R code ... WARNING
'::' or ':::' import not declared from: ‘geoChronR’

checking for missing documentation entries ... WARNING
Undocumented code objects:
  ‘test_extractTs’ ‘test_extractTsCorrectCount’
  ‘test_extractTsUniqueTsids’ ‘test_lipdread’
All user-level objects in a package should have documentation entries.
See chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.

checking for code/documentation mismatches ... WARNING
Codoc mismatches from documentation object 'collapseTs':
collapseTs
  Code: function(ts, force = FALSE)
  Docs: function(ts)
  Argument names in code not in docs:
    force

Codoc mismatches from documentation object 'filterTs':
filterTs
... 10 lines ...
  Argument names in code not in docs:
    exact

Codoc mismatches from documentation object 'writeLipd':
writeLipd
  Code: function(D, path = NULL, ignore.warnings = FALSE)
  Docs: function(D, path)
  Argument names in code not in docs:
    ignore.warnings
  Mismatches in argument default values:
    Name: 'path' Code: NULL Docs: 

checking Rd \usage sections ... WARNING
Undocumented arguments in documentation object 'build_structure'
  ‘d’ ‘pc’ ‘table_type’ ‘pcNumber’ ‘modelNumber’ ‘tableNumber’
Duplicated \argument entries in documentation object 'build_structure':
  ‘char’ ‘num’ ‘num’
Documented arguments not in \usage in documentation object 'build_structure':
  ‘list’ ‘char’ ‘num’

Documented arguments not in \usage in documentation object 'collapseTs':
  ‘force’
... 65 lines ...
  ‘d’ ‘pc’ ‘whichtables’
Duplicated \argument entries in documentation object 'rm_existing_tables':
  ‘char’
Documented arguments not in \usage in documentation object 'rm_existing_tables':
  ‘list’ ‘char’

Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.

checking Rd contents ... WARNING
Argument items with no description in Rd object 'lumpTsMetaVariables':
  ‘Ts’ ‘sc’

checking for unstated dependencies in examples ... WARNING
Warning: parse error in file 'lipdR-Ex.R':
60:6: unexpected '['
59: # Time series
60: ts = [
         ^

checking for hidden files and directories ... NOTE
Found the following hidden files and directories:
  tests/.RData
These were most likely included in error. See section ‘Package
structure’ in the ‘Writing R Extensions’ manual.

checking DESCRIPTION meta-information ... NOTE
Malformed Description field: should contain one or more complete sentences.

checking top-level files ... NOTE
Non-standard file/directory found at top level:
  ‘log’

checking R code for possible problems ... NOTE
download_from_url: no visible global function definition for
  ‘download.file’
put_base_data: no visible binding for global variable ‘L’
unzipper: no visible global function definition for ‘unzip’
update_lipd_v1_3_keys: no visible global function definition for
  ‘setNames’
validate_parameters: no visible binding for global variable ‘d’
write_csv_to_file: no visible global function definition for
  ‘write.table’
... 6 lines ...
  importFrom("utils", "download.file", "unzip", "write.table", "zip")
to your NAMESPACE file.

Found the following assignments to the global environment:
File ‘lipdR/R/bag.R’:
  assign("bagit.script", bagit.script, envir = .GlobalEnv)
  assign("bagit.script", bagit.script, envir = .GlobalEnv)
  assign("bagit.script", "none", envir = .GlobalEnv)
  assign("bagit.script", "none", envir = .GlobalEnv)
File ‘lipdR/R/timeseries_extract.R’:
  assign("TMP_ts_storage", tmp_storage, envir = .GlobalEnv)```
chrismheiser commented 4 years ago

Bump. This issue needs to be put back on the priority list. Nick says he has ideas on how to remove global variables and meet the CRAN requirements

I'd love to make the required modifications to make lipdR a package on CRAN. I think I have solutions for two major issues (global variables and calling the python bag it).