Last updated: 2020-02-25

Checks: 2 0

Knit directory: RcppComputingClub/

This reproducible R Markdown analysis was created with workflowr (version 1.6.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Unstaged changes:
    Modified:   analysis/index.Rmd

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view them.

File Version Author Date Message
Rmd 478270d scristia 2020-02-25 wflow_publish(files = “packages.Rmd”)
html 303d980 scristia 2020-02-25 Build site.
Rmd 560db78 scristia 2020-02-25 wflow_git_commit(all = TRUE, files = c(“index.Rmd”, “intro.Rmd”,

Anatomy of an R Package

Inspection of R source code for any R package will reveal the following directories and files:

  • R: for R functions
  • vignettes: Latex papers weaving R code and indicating the intended workflow of an analysis
  • man: documentation for exported R functions
  • src: compiled code
  • DESCRIPTION: file provides a brief description of the project, a version number, and any packages for which your package depends.

Using Rcpp:

  • All compiled code goes in package/src directory
  • Code in src/ will be automatically compiled and shared libraries created when building the package.
  • Instantiate an Rcpp package: Rcpp.package.skeleton

devtools

  • devtools::use_rcpp() to set your package up with Rcpp. This will
    • create a src/ directory for your compiled code
    • Add Rcpp to the LinkingTo and Imports fields in the DESCRIPTION.
    • Set up your .gitignore to ignore compiled output files
    • Give you roxygen flags to add to your package

roxygen can be used to add documentation to your C++ written functions in the usual with, but with //‘ instead of #’.

Exporting/importing C++ code

Use header (.h) files to make your C++ functions callable elsewhere.