software-review icon indicating copy to clipboard operation
software-review copied to clipboard

rpigpior

Open mnr opened this issue 1 year ago • 11 comments

Submitting Author Name: Mark Niemann-Ross Submitting Author Github Handle: @mnr Other Package Authors Github handles: (comma separated, delete if none) Repository: https://github.com/mnr/rpigpior Version submitted:0.0.0.1 Submission type: Standard Editor: TBD Reviewers: TBD

Archive: TBD Version accepted: TBD Language: en


  • Paste the full DESCRIPTION file inside a code block below:
This provides R with access to the Raspberry Pi General Purpose Input Output (GPIO) via 'libgpiod'. This includes detecting a gpio chip as well as turning pins on and off via [gpioset()] and reading the state of pins via [gpioget()]. No additional libraries need to be installed; Raspbian includes 'libgpiod' as part of the standard installation.

Scope

  • Please indicate which category or categories from our package fit policies this package falls under: (Please check an appropriate box below. If you are unsure, we suggest you make a pre-submission inquiry.):

    • [ ] data retrieval
    • [ ] data extraction
    • [ ] data munging
    • [ ] data deposition
    • [ ] data validation and testing
    • [ ] workflow automation
    • [ ] version control
    • [ ] citation management and bibliometrics
    • [ ] scientific software wrappers
    • [x] field and lab reproducibility tools
    • [ ] database software bindings
    • [ ] geospatial data
    • [ ] text analysis
  • Explain how and why the package falls under these categories (briefly, 1-2 sentences): Raspberry Pi is part of the Internet of Things and is used as laboratory equipment. Other applications include automation, field sampling and analysis, and prototyping.

  • Who is the target audience and what are scientific applications of this package? Field analysts and prototype creators.

  • Are there other R packages that accomplish the same thing? If so, how does yours differ or meet our criteria for best-in-category? https://r4pi.org provides a version of R for the Raspberry Pi, but does not provide packaged access to the general purpose input/output (GPIO) pins. At some point, it is possible rpigpior could be included with their distribution.

  • (If applicable) Does your package comply with our guidance around Ethics, Data Privacy and Human Subjects Research? yes

  • If you made a pre-submission inquiry, please paste the link to the corresponding issue, forum post, or other discussion, or @tag the editor you contacted.

  • Explain reasons for any pkgcheck items which your package is unable to pass.

Technical checks

Confirm each of the following by checking the box.

This package:

Publication options

  • [x] Do you intend for this package to go on CRAN?

  • [ ] Do you intend for this package to go on Bioconductor?

  • [ ] Do you wish to submit an Applications Article about your package to Methods in Ecology and Evolution? If so:

MEE Options
  • [ ] The package is novel and will be of interest to the broad readership of the journal.
  • [ ] The manuscript describing the package is no longer than 3000 words.
  • [ ] You intend to archive the code for the package in a long-term repository which meets the requirements of the journal (see MEE's Policy on Publishing Code)
  • (Scope: Do consider MEE's Aims and Scope for your manuscript. We make no guarantee that your manuscript will be within MEE scope.)
  • (Although not required, we strongly recommend having a full manuscript prepared when you submit here.)
  • (Please do not submit your package separately to Methods in Ecology and Evolution)

Code of conduct

  • [x] I agree to abide by rOpenSci's Code of Conduct during the review process and in maintaining my package should it be accepted.

mnr avatar Apr 26 '24 01:04 mnr

Thanks for submitting to rOpenSci, our editors and @ropensci-review-bot will reply soon. Type @ropensci-review-bot help for help.

ropensci-review-bot avatar Apr 26 '24 01:04 ropensci-review-bot

:rocket:

Editor check started

:wave:

ropensci-review-bot avatar Apr 26 '24 01:04 ropensci-review-bot

Checks for rpigpior (v0.1.0)

git hash: 30e4ba66

  • :heavy_check_mark: Package name is available
  • :heavy_check_mark: has a 'codemeta.json' file.
  • :heavy_multiplication_x: does not have a 'contributing' file.
  • :heavy_check_mark: uses 'roxygen2'.
  • :heavy_check_mark: 'DESCRIPTION' has a URL field.
  • :heavy_check_mark: 'DESCRIPTION' has a BugReports field.
  • :heavy_check_mark: Package has at least one HTML vignette
  • :heavy_check_mark: All functions have examples.
  • :heavy_check_mark: Package has continuous integration checks.
  • :heavy_multiplication_x: Package coverage failed
  • :heavy_multiplication_x: R CMD check found 1 error.
  • :heavy_multiplication_x: R CMD check found 1 warning.

Important: All failing checks above must be addressed prior to proceeding

Package License: MIT + file LICENSE


1. Package Dependencies

Details of Package Dependency Usage (click to open)

The table below tallies all function calls to all packages ('ncalls'), both internal (r-base + recommended, along with the package itself), and external (imported and suggested packages). 'NA' values indicate packages to which no identified calls to R functions could be found. Note that these results are generated by an automated code-tagging system which may not be entirely accurate.

type package ncalls
internal base 21
internal rpigpior 10
internal utils 1
imports NA NA
suggests knitr NA
suggests rmarkdown NA
suggests testthat NA
linking_to NA NA

Click below for tallies of functions used in each package. Locations of each call within this package may be generated locally by running 's <- pkgstats::pkgstats(<path/to/repo>)', and examining the 'external_calls' table.

base

paste (6), system (3), c (2), for (2), as.integer (1), if (1), length (1), names (1), paste0 (1), regexec (1), regmatches (1), tryCatch (1)

rpigpior

rpi_pinToBCM (4), is.rpi (1), pwm_func (1), rpi_get (1), rpi_i2c_get (1), rpi_i2c_set (1), rpi_pin_desc (1)

utils

read.table (1)

NOTE: No imported packages appear to have associated function calls; please ensure with author that these 'Imports' are listed appropriately.


2. Statistical Properties

This package features some noteworthy statistical properties which may need to be clarified by a handling editor prior to progressing.

Details of statistical properties (click to open)

The package has:

  • code in R (100% in 10 files) and
  • 1 authors
  • 6 vignettes
  • 1 internal data file
  • 1 imported package
  • 8 exported functions (median 19 lines of code)
  • 10 non-exported functions in R (median 29 lines of code)

Statistical properties of package structure as distributional percentiles in relation to all current CRAN packages The following terminology is used:

  • loc = "Lines of Code"
  • fn = "function"
  • exp/not_exp = exported / not exported

All parameters are explained as tooltips in the locally-rendered HTML version of this report generated by the checks_to_markdown() function

The final measure (fn_call_network_size) is the total number of calls between functions (in R), or more abstract relationships between code objects in other languages. Values are flagged as "noteworthy" when they lie in the upper or lower 5th percentile.

measure value percentile noteworthy
files_R 10 59.0
files_vignettes 6 97.9
files_tests 10 90.7
loc_R 266 29.4
loc_vignettes 293 62.8
loc_tests 137 46.6
num_vignettes 6 98.7 TRUE
data_size_total 483 58.5
data_size_median 483 60.2
n_fns_r 18 25.1
n_fns_r_exported 8 38.3
n_fns_r_not_exported 10 22.3
n_fns_per_file_r 1 16.1
num_params_per_fn 2 30.8
loc_per_fn_r 22 63.6
loc_per_fn_r_exp 20 46.3
loc_per_fn_r_not_exp 30 78.0
rel_whitespace_R 17 32.6
rel_whitespace_vignettes 60 81.6
rel_whitespace_tests 6 18.6
doclines_per_fn_exp 22 17.3
doclines_per_fn_not_exp 0 0.0 TRUE
fn_call_network_size 9 30.9

2a. Network visualisation

Click to see the interactive network visualisation of calls between objects in package


3. goodpractice and other checks

Details of goodpractice checks (click to open)

3a. Continuous Integration Badges

R-CMD-check.yaml

GitHub Workflow Results

id name conclusion sha run_number date
8832736528 pages build and deployment success b265f5 121 2024-04-25
8832871972 pkgdown failure 30e4ba 151 2024-04-25
8832871969 R-CMD-check failure 30e4ba 146 2024-04-25

3b. goodpractice results

R CMD check with rcmdcheck

R CMD check generated the following error:

  1. checking tests ... Running ‘testthat.R’ ERROR Running the tests in ‘tests/testthat.R’ failed. Last 13 lines of output: 'test-rpi_i2c_get.R:11:3', 'test-rpi_i2c_get.R:20:3', 'test-rpi_i2c_get.R:29:3', 'test-rpi_monitor.R:2:3', 'test-rpi_pwm.R:2:3', 'test-rpi_pwm.R:7:3', 'test-rpi_pwm.R:12:3', 'test-rpi_pwm.R:17:3', 'test-rpi_set.R:3:3'

══ Failed tests ════════════════════════════════════════════════════════════════ ── Failure ('test-is.R:2:3'): is.rpi confirms/denies RPi ─────────────────────── if (...) NULL is not TRUE

actual is NULL expected is a logical vector (TRUE)

[ FAIL 1 | WARN 0 | SKIP 10 | PASS 43 ] Error: Test failures Execution halted

R CMD check generated the following warning:

  1. checking package subdirectories ... WARNING Invalid citation information in ‘inst/CITATION’: Error in bibentry(bibtype = entry, textVersion = textVersion, header = header, footer = footer, ...): argument is missing, with no default

R CMD check generated the following test_fail:

  1. This file is part of the standard setup for testthat.

It is recommended that you do not modify it.

Where should you do additional test configuration?

Learn more about the roles of various files in:

* https://r-pkgs.org/tests.html

* https://testthat.r-lib.org/reference/test_package.html#special-files

library(testthat) library(rpigpior)

test_check("rpigpior") Real world test of setting board pin 11 [ FAIL 1 | WARN 0 | SKIP 10 | PASS 43 ]

══ Skipped tests (10) ══════════════════════════════════════════════════════════ • is.rpi() is not TRUE (10): 'test-rpi_i2c_get.R:2:3', 'test-rpi_i2c_get.R:11:3', 'test-rpi_i2c_get.R:20:3', 'test-rpi_i2c_get.R:29:3', 'test-rpi_monitor.R:2:3', 'test-rpi_pwm.R:2:3', 'test-rpi_pwm.R:7:3', 'test-rpi_pwm.R:12:3', 'test-rpi_pwm.R:17:3', 'test-rpi_set.R:3:3'

══ Failed tests ════════════════════════════════════════════════════════════════ ── Failure ('test-is.R:2:3'): is.rpi confirms/denies RPi ─────────────────────── if (...) NULL is not TRUE

actual is NULL expected is a logical vector (TRUE)

[ FAIL 1 | WARN 0 | SKIP 10 | PASS 43 ] Error: Test failures Execution halted

R CMD check generated the following check_fail:

  1. rcmdcheck_tests_pass

Test coverage with covr

ERROR: Test Coverage Failed

Cyclocomplexity with cyclocomp

The following function have cyclocomplexity >= 15:

function cyclocomplexity
rpi_pwm 29

Static code analyses with lintr

lintr found the following 50 potential issues:

message number of times
Avoid library() and require() calls in packages 6
Lines should not be more than 80 characters. 43
unexpected symbol 1

Package Versions

package version
pkgstats 0.1.3.13
pkgcheck 0.1.2.21

Editor-in-Chief Instructions:

Processing may not proceed until the items marked with :heavy_multiplication_x: have been resolved.

ropensci-review-bot avatar Apr 26 '24 01:04 ropensci-review-bot

Hi @mnr ! Please click the 3 dots in the upper right corner of your original comment to edit, then fill in the response to the fields. A quick glance at your package makes me think it could fit in the "field and laboratory reproducibility tools" category. Playing with a Raspberry Pi is high on my list of things to do, so I'm excited to see this submission.

Once the grey "X"'s are fixed and the original submission fields are updated, I'll take a closer look. Thanks for your submission.

ldecicco-USGS avatar Apr 26 '24 16:04 ldecicco-USGS

Thanks for the advice. I missed the questions below the scroll and have filled those out.

I was also able to clean up the R CMD checks.

So...I think we are good to go?

MNR

mnr avatar Apr 29 '24 00:04 mnr

@ropensci-review-bot check package

ldecicco-USGS avatar Apr 30 '24 14:04 ldecicco-USGS

Thanks, about to send the query.

ropensci-review-bot avatar Apr 30 '24 14:04 ropensci-review-bot

:rocket:

Editor check started

:wave:

ropensci-review-bot avatar Apr 30 '24 14:04 ropensci-review-bot

Checks for rpigpior (v0.1.0)

git hash: 6885db4d

  • :heavy_check_mark: Package name is available
  • :heavy_check_mark: has a 'codemeta.json' file.
  • :heavy_check_mark: has a 'contributing' file.
  • :heavy_check_mark: uses 'roxygen2'.
  • :heavy_check_mark: 'DESCRIPTION' has a URL field.
  • :heavy_check_mark: 'DESCRIPTION' has a BugReports field.
  • :heavy_check_mark: Package has at least one HTML vignette
  • :heavy_check_mark: All functions have examples.
  • :heavy_check_mark: Package has continuous integration checks.
  • :heavy_multiplication_x: Package coverage is 14.4% (should be at least 75%).
  • :heavy_check_mark: R CMD check found no errors.
  • :heavy_check_mark: R CMD check found no warnings.

Important: All failing checks above must be addressed prior to proceeding

Package License: MIT + file LICENSE


1. Package Dependencies

Details of Package Dependency Usage (click to open)

The table below tallies all function calls to all packages ('ncalls'), both internal (r-base + recommended, along with the package itself), and external (imported and suggested packages). 'NA' values indicate packages to which no identified calls to R functions could be found. Note that these results are generated by an automated code-tagging system which may not be entirely accurate.

type package ncalls
internal base 21
internal rpigpior 10
internal utils 1
imports NA NA
suggests knitr NA
suggests rmarkdown NA
suggests testthat NA
linking_to NA NA

Click below for tallies of functions used in each package. Locations of each call within this package may be generated locally by running 's <- pkgstats::pkgstats(<path/to/repo>)', and examining the 'external_calls' table.

base

paste (6), system (3), c (2), for (2), as.integer (1), if (1), length (1), names (1), paste0 (1), regexec (1), regmatches (1), tryCatch (1)

rpigpior

rpi_pinToBCM (4), is.rpi (1), pwm_func (1), rpi_get (1), rpi_i2c_get (1), rpi_i2c_set (1), rpi_pin_desc (1)

utils

read.table (1)

NOTE: No imported packages appear to have associated function calls; please ensure with author that these 'Imports' are listed appropriately.


2. Statistical Properties

This package features some noteworthy statistical properties which may need to be clarified by a handling editor prior to progressing.

Details of statistical properties (click to open)

The package has:

  • code in R (100% in 10 files) and
  • 1 authors
  • 6 vignettes
  • 1 internal data file
  • 1 imported package
  • 8 exported functions (median 19 lines of code)
  • 10 non-exported functions in R (median 29 lines of code)

Statistical properties of package structure as distributional percentiles in relation to all current CRAN packages The following terminology is used:

  • loc = "Lines of Code"
  • fn = "function"
  • exp/not_exp = exported / not exported

All parameters are explained as tooltips in the locally-rendered HTML version of this report generated by the checks_to_markdown() function

The final measure (fn_call_network_size) is the total number of calls between functions (in R), or more abstract relationships between code objects in other languages. Values are flagged as "noteworthy" when they lie in the upper or lower 5th percentile.

measure value percentile noteworthy
files_R 10 59.0
files_vignettes 6 97.9
files_tests 10 90.7
loc_R 266 29.4
loc_vignettes 293 62.8
loc_tests 138 46.7
num_vignettes 6 98.7 TRUE
data_size_total 483 58.5
data_size_median 483 60.2
n_fns_r 18 25.1
n_fns_r_exported 8 38.3
n_fns_r_not_exported 10 22.3
n_fns_per_file_r 1 16.1
num_params_per_fn 2 30.8
loc_per_fn_r 22 63.6
loc_per_fn_r_exp 20 46.3
loc_per_fn_r_not_exp 30 78.0
rel_whitespace_R 18 33.1
rel_whitespace_vignettes 60 81.6
rel_whitespace_tests 6 18.6
doclines_per_fn_exp 22 17.3
doclines_per_fn_not_exp 0 0.0 TRUE
fn_call_network_size 9 30.9

2a. Network visualisation

Click to see the interactive network visualisation of calls between objects in package


3. goodpractice and other checks

Details of goodpractice checks (click to open)

3a. Continuous Integration Badges

R-CMD-check.yaml

GitHub Workflow Results

id name conclusion sha run_number date
8871392503 pages build and deployment success d9ee99 134 2024-04-29
8871375569 pkgdown success 6885db 164 2024-04-29
8871375565 R-CMD-check success 6885db 159 2024-04-29

3b. goodpractice results

R CMD check with rcmdcheck

rcmdcheck found no errors, warnings, or notes

Test coverage with covr

Package coverage: 14.36

The following files are not completely covered by tests:

file coverage
R/rpi_get.R 0%
R/rpi_i2c_get.R 0%
R/rpi_i2c_set.R 0%
R/rpi_monitor.R 0%
R/rpi_pwm.R 0%
R/rpi_set.R 0%

Cyclocomplexity with cyclocomp

The following function have cyclocomplexity >= 15:

function cyclocomplexity
rpi_pwm 29

Static code analyses with lintr

lintr found the following 50 potential issues:

message number of times
Avoid library() and require() calls in packages 6
Lines should not be more than 80 characters. 43
unexpected symbol 1

Package Versions

package version
pkgstats 0.1.3.13
pkgcheck 0.1.2.21

Editor-in-Chief Instructions:

Processing may not proceed until the items marked with :heavy_multiplication_x: have been resolved.

ropensci-review-bot avatar Apr 30 '24 14:04 ropensci-review-bot

So - I need some guidance on this. It appears that covr doesn't like my unit tests.

Here's the problem:

  • most of these tests will fail if there isn't a Raspberry Pi GPIO present to test.
  • To avoid those failures, I always check for presence of Raspberry Pi. skip_if_not(is.rpi(), message = "Not a Raspberry Pi")
  • many of these tests will fail if there isn't a switch, or LED, or i2c device connected to the RPi GPIO

Because I'm avoiding obvious failures, covr states "The following files are not completely covered by tests:"

In some cases, there is a robust set of tests - but requires significant set-up to test. For example, rpi_i2c_get includes this test...

` test_that("rpi_i2c_get err chip address", {

skip_if_not(is.rpi(), message = "Not a Raspberry Pi")

expect_error(rpi_i2c_get(

    chip_address = 0x07,

    data_address = 0xf0,

    data_size = "b"

  ))

 }) `

...which means a successful test requires an i2c device is connected to the RPi and is configured to appear at chip address 0x77 and produces expected data at 0xf0

Your help is appreciated. MNR

mnr avatar Apr 30 '24 17:04 mnr

@mnr The inability to test coverage is in your case not a problem. Special hardware requirements are not something we even thought about in developing this system. I might have a play on my own pi, but other than that we can just wait for Editor-in-Chief @jooolia to make a judgement on scope here and proceed regardless of reported coverage.

mpadge avatar May 02 '24 10:05 mpadge

Thank you for your submission to rOpenSci.

After careful consideration, we have determined that your submission is out of scope for our "field and lab reproducibility tools" category. While we recognise the utility of your package for many users, it is not specifically aligned to rOpenSci's focus on reproducibility in lab and field through the standardization and automation of real-world workflows.

Thank you again for considering rOpenSci, and please feel free to submit other packages for consideration in the future.

Sincerely, Julia Gustavsen

jooolia avatar May 29 '24 18:05 jooolia

@ropensci-review-bot out of scope

jooolia avatar May 29 '24 18:05 jooolia