Introduction

This is the first part of an example data analysis. In this example we’ll do some basic data pre-processing and then export the dataset for use in the downstream analysis.

We’ll use the (outdated and not very exciting) mtcars dataset for this analysis. This consists of 11 variables for 32 car models build in 1973 and 1974. The first few rows of the dataset are shown in Table 1.

Table 1: The mtcars dataset (download).

 mpgcyldisphpdratwtqsecvsamgearcarb
Mazda RX42161601103.92.6216.50144
Mazda RX4 Wag2161601103.92.88170144
Datsun 71022.84108933.852.3218.61141
Hornet 4 Drive21.462581103.083.2119.41031
Hornet Sportabout18.783601753.153.44170032
Valiant18.162251052.763.4620.21031

The only thing we’ll do for the purpose of this example is to add an additional column to indicate whether the car was build in the US or elsewhere.

international <- c(1:3, 8:14, 18:21, 26:28, 30:32)
ext_cars <- mtcars
ext_cars$origin <- 'US'
ext_cars$origin[international] <- 'international'

Appendix

Custom Functions

## Custom functions used in the analysis should go into this chunk.
## They will be listed in their own section of the appendix.

Configuration

## This chunk should contain global configuration commands.
## Use this to set knitr options and related things. Everything
## in this chunk will be included in an appendix to document the
## configuration used.

## Pander options
panderOptions("digits", 3)
panderOptions("table.split.table", 160)

Version

Document version

Fri Mar 17 13:48:07 2017

Session Info

  • platform:

    • version: R version 3.3.1 (2016-06-21)
    • system: x86_64, mingw32
    • ui: RTerm
    • language: (EN)
    • collate: English_Australia.1252
    • tz: Australia/Sydney
    • date: 2017-03-17
  • packages:

    package*versiondatesource
    assertthat0.12013-12-06CRAN (R 3.3.1)
    backports1.0.52017-01-18CRAN (R 3.3.2)
    base64enc0.1-32015-07-28CRAN (R 3.3.0)
    callr1.0.0.90002017-02-16Github (mangothecat/callr@c02300a)
    codetools0.2-142015-07-15CRAN (R 3.3.1)
    colorspace1.3-22016-12-14CRAN (R 3.3.2)
    colourpicker0.32016-12-05CRAN (R 3.3.2)
    DBI0.62017-03-09CRAN (R 3.3.3)
    devtools1.12.02016-06-24CRAN (R 3.3.1)
    digest0.6.122017-01-27CRAN (R 3.3.2)
    dplyr0.5.02016-06-24CRAN (R 3.3.1)
    evaluate0.102016-10-11CRAN (R 3.3.2)
    ggplot2*2.2.1.90002017-03-16Github (tidyverse/ggplot2@08e135e)
    gtable0.2.02016-02-26CRAN (R 3.3.1)
    htmltools0.3.52016-03-21CRAN (R 3.3.1)
    htmlwidgets0.82016-11-09CRAN (R 3.3.2)
    httpuv1.3.32015-08-04CRAN (R 3.3.2)
    httr1.2.12016-07-03CRAN (R 3.3.1)
    jsonlite1.32017-02-28CRAN (R 3.3.3)
    knitr*1.15.12016-11-22CRAN (R 3.3.2)
    lazyeval0.2.02016-06-12CRAN (R 3.3.1)
    magrittr1.52014-11-22CRAN (R 3.3.1)
    memoise1.0.02016-01-29CRAN (R 3.3.1)
    mime0.52016-07-07CRAN (R 3.3.1)
    miniUI0.1.12016-01-15CRAN (R 3.3.2)
    munsell0.4.32016-02-13CRAN (R 3.3.1)
    pander*0.6.02015-11-23CRAN (R 3.3.1)
    plotly*4.5.6.90002017-02-16Github (ropensci/plotly@cbf5885)
    plyr1.8.42016-06-08CRAN (R 3.3.1)
    purrr0.2.22016-06-18CRAN (R 3.3.2)
    R62.2.02016-10-05CRAN (R 3.3.2)
    Rcpp0.12.92017-01-14CRAN (R 3.3.2)
    reportMD*0.4.02017-02-28local
    rmarkdown1.32016-12-21CRAN (R 3.3.2)
    rprojroot1.22017-01-16CRAN (R 3.3.2)
    scales0.4.12016-11-09CRAN (R 3.3.2)
    shiny1.0.02017-01-12CRAN (R 3.3.2)
    stringi1.1.22016-10-01CRAN (R 3.3.2)
    stringr1.2.02017-02-18CRAN (R 3.3.3)
    tibble1.22016-08-26CRAN (R 3.3.1)
    tidyr0.6.12017-01-10CRAN (R 3.3.2)
    viridisLite0.1.32016-03-12CRAN (R 3.3.2)
    withr1.0.22016-06-20CRAN (R 3.3.1)
    xml21.1.12017-01-24CRAN (R 3.3.2)
    xtable1.8-22016-02-05CRAN (R 3.3.2)
    yaml2.1.142016-11-12CRAN (R 3.3.2)

Downloads

FileDescription
Table 1The mtcars dataset.

Created with reportMD