Giter VIP home page Giter VIP logo

afnistats's Introduction

afnistats, a possible alternative for packaging AFNI's R code

This is a a demo of what an "afnistats" packaging would look like. This would help automate testing/dependency management to move towards an improved installation experience across OSes/R versions.

It follows as best it can the guidance of "R packaging". This is helpfully summarized in the Rstudio cheatsheet.

The principle efforts in refactoring the code here are for the purposes of :

  • establishing compatible with R's packaging infrastructure
  • adding tests for a basic guarantee of functionality
  • reducing redundancy by having user inputs, their default values, and their help messages specified in a single location
  • add basic input validation in an automated manner (check for number of arguments and their type for the various arugments)
  • make use of R's documentation infrastructure for convenient access from within R
  • specify dependencies in a standard way
  • attempt to conform a little better to community styleguides

Work to be done

This is far from a complete work. Things to consider for improvement:

  • consider compatibility with R_io.so. R has extensive support for compiling C as part of packaging building but a more realistic solution for distribution with the rest of AFNI is to assume R_io.so is already installed. This would be trivial on conda to specify a dependency. On other OSes, specifying dependencies using homebrew/apt package managers would work to a degree but limited support would be offered there. Looking into how to specify dependencies on system libraries within RCran is likely a reasonable way forward
  • extend the list of refactored programs beyond MBA and RBA. This would take time. As common code across various tools is extracted into generic functions this task will become easier and easier to do. For now it is somewhat depending (taking hours-days for each refactored script)
  • consider how R specifies dependencies on tools that are used via system calls
  • there are a few minor details to be compliant with CRAN but overall the package is very close to fully compatible.
  • there are some tests failing. When I stopped working on this I was attempting to write some code for some basic validation of input data given the model specification (as in are the variables sufficiently crossed/replicated etc). Jumping back a few commits to a work version may be a more sensible starting point. Though the more extensive data validation would be nice to have. For MBA, inadequate data may not raise an error until a few weeks in to training the model...

Testing the package out

With docker from the repository directory:

sudo docker run --rm -ti -v $PWD:/home/rstudio/work -e PASSWORD=hello -e ROOT=TRUE -e USERID=`id -u` -p 8787:8787 rocker/tidyverse

Going to a localhost:8787 to access an Rstudio instance and load the afnistats.proj file in the work directory. Follow the standard packaging operations as described in the packaging cheatsheet.

A sensible start would be running the following commands in the R console:

devtools::install_deps(upgrade="never")
devtools::check()

To test versions of R

Circleci is setup to run an installation and some basic checks for every commit to github across differnt versions of R. It is not especially useful but you can run these locally using the local circleci interface. So for example:

circleci local execute --job test_3.6.3

afnistats's People

Contributors

leej3 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.