Introduction and Overview

Michael C Sachs

2019-11-27

Introduction

Goals

At a bare minimum, we want code to be:

Organized

Transportable

Understandable

Extras

Nice to have, but not absolutely necessary

Provably correct

Through automated testing

Version controlled

Discoverable

How to achieve these goals?

Building an R package is one way, with many distinct advantages

Documented structure and community-based conventions

Building R extensions

Infrastructure

The Components of an R Package

What is an R package?

Woody: Buzz, you’re flying!

Buzz Lightyear: This isn’t flying, this is R coding with style.

Description

The DESCRIPTION file contains basic information about the package in the following format:

Package: pkgname
Version: 0.5-1
Date: 2015-01-01
Title: My First Collection of Functions
Authors@R: c(person("Joe", "Developer", role = c("aut", "cre"),
                     email = "Joe.Developer@some.domain.net"),
              person("Pat", "Developer", role = "aut"),
              person("A.", "User", role = "ctb",
                     email = "A.User@whereever.net"))
Author: Joe Developer [aut, cre],
  Pat Developer [aut],
  A. User [ctb]
Maintainer: Joe Developer <Joe.Developer@some.domain.net>
Depends: R (>= 3.1.0), nlme
Suggests: MASS
Description: A (one paragraph) description of what
  the package does and why it may be useful.
License: GPL (>= 2)
URL: https://www.r-project.org, http://www.another.url
BugReports: https://pkgname.bugtracker.url

License

Pick a license, any license

Failing to include a license implicity declares a copyright without explaining if or how others can use your code

I prefer the MIT license, it is short and understandable to lay people

https://opensource.org/licenses/alphabetical

R code

The R/ subdirectory contains your code

Namespace

A text file that specifies the directives of your package

Documentation

Everything else

Files

Subdirectories

Overview of this workshop

Lessons

Sticky note system

Lectures

Schedule

Today

Tomorrow

Friday

Friday afternoon

volunteers needed!