options(htmltools.dir.version = FALSE)
library(ggplot2)
library(pearsonverse)

knitr::opts_chunk$set(comment = "#>")

Agenda

--

--

--

--

--


class: center, middle

What is Pearsonverse?


class: center, middle

Pearsonverse is a collection of in-house packages that make it easier to conduct an exploratory data science project in R from start to end.


background-image: url('intro_img/vispear_ex1.png') background-size: 70%


background-image: url('intro_img/vispear_ex2.png') background-size: 70%


background-image: url('intro_img/index_ex.png') background-size: 70%


background-image: url('intro_img/report_ex.png') background-size: 70%


class: middle, center

Final report example


class: center, middle

The world before Pearsonverse


The world before Pearsonverse

--

Everybody in our team ...

--

--

--

--


class: center, middle

Pearsonverse solves all those problems!


Pearsonverse

--

Collection of packages:

--

  1. skelpear a standardised project environment that facilitates collaboration.

--

  1. reppear a standardised report layout that facilitates reproducibility.

--

  1. vispear a standardised visualisation template.

.bottom-text[ See pearsonverse documentation on GitHub. ]


Pearsonverse

All you have to do is:

# Install package
devtools::install_github("pearsonplc/pearsonverse")

# Attach package
library(pearsonverse)


class: center middle no-page-number background-image: url('img/divider_blue.jpg') background-size: 100%

Project Phases


Project phases

  1. Build a project environment (skelpear)

--

  1. Conduct the analysis (vispear)

--

  1. Produce a report (reppear, vispear)

--

  1. Publish it (reppear)

--

Throughout the entire project: Maintain reproducibility (skelpear)


class: center middle no-page-number background-image: url('img/divider_blue.jpg') background-size: 100%

Building a project
environment


Project environment

.small-code[

skelpear::project_create(name = "project", path = ".")

]

--

Two arguments

--

name - Project name. Must be a valid directory name for your file system.

--

path - A path for storing your new project.


Project environment

.small-code[

skelpear::project_create(name = "project", path = ".")

]

  1. After executing project_create(), a new RStudio session will open automatically.

--

  1. The function initialises a git environment.

Project environment

.small-code[

skelpear::project_create(name = "project", path = ".")

]

--

.bottom-text[ More info about each directory in the documentation. ]


class: middle, center

Showtime


Project environment + git

To push your project to bitbucket, you need to do 2 things:

--

  1. Create a repository on bitbucket.

-- 2. In terminal, use git remote add origin <remote_URL> to link your local project with the bitbucket repository.

--

After that, you're ready to push your commit/s.


class: center middle no-page-number background-image: url('img/divider_blue.jpg') background-size: 100%

Conduct
the analysis


Conduct the analysis

Basic layout .pull-three[ .small-code[


ggplot(mtcars, 
       aes(x = qsec, 
           y = mpg, 
           color = factor(cyl)
           )
       ) + 
  geom_point(size = 5)

]]

.pull-seven[

ggplot(mtcars, aes(qsec, mpg, color = factor(cyl))) + 
  geom_point(size = 5)

]

Conduct the analysis

theme_enr layout .pull-three[ .small-code[


ggplot(mtcars, 
       aes(x = qsec, 
           y = mpg, 
           color = factor(cyl)
           )
       ) + 
  geom_point(size = 5) +
  theme_enr(color = p_colors)

]]

.pull-seven[

ggplot(mtcars, aes(qsec, mpg, color = factor(cyl))) + 
  geom_point(size = 5) +
  theme_enr(color = p_colors)

]

Conduct the analysis

Save plot

There are two functions:

--

.small-code[

plot <- ggplot(mtcars, aes(qsec, mpg, color = factor(cyl))) + 
  geom_point(size = 5) +
  theme_enr(color = p_colors)

# .png and .pdf files are created
save_plot2(name = plot, 
           file = "graphs/01_mtcars") 

]

.bottom-text[ Both functions are compatible with the theme_enr layout. ]


class: middle, center

Showtime


Conduct the analysis

Show palettes

The function show_enr_palettes() lists all palletes available in the vispear package.

--

.small-code[

vispear::show_enr_palettes()
palette_list <- lapply(vispear::show_enr_palettes(), attributes)
data.frame(name = names(palette_list), description = unlist(unname(palette_list)))

]


Conduct the analysis

.small-code[

datatable_enr(mtcars, tooltip = "This is the description of table.")

]

.bottom-text[ Read more about the function in documentation (Epic or VPN required). ]


class: center middle no-page-number background-image: url('img/divider_blue.jpg') background-size: 100%

Produce
the report


Produce the report

reppear::report_create(file = "01_report", subdir = "reports")

--


Produce the report

reppear::report_create(file = "01_report", subdir = "reports")

--

Two arguments

--

file - Report name. Must be a valid directory name for your file system.

--

subdir - Subdirectory where you want to store your new report.


Produce the report

reppear::report_create(file = "01_report", subdir = "reports")

--

-- - index.Rmd - a file which acts as a home page for all reports within the project*.

.bottom-text[ *More info about the file in documentation. ]


Produce the report

To render index.Rmd,

reppear::render_index()

--

It re/builds index.html, tooltip_content.html and header.html files.


class: middle, center

Showtime


class: center middle no-page-number background-image: url('img/divider_blue.jpg') background-size: 100%

Publish it


Publish it

reppear::publish(file = "reports/")

.bottom-text[ For now only kvm1-e01.ioki.pl server is defined. ]


class: center middle no-page-number background-image: url('img/divider_blue.jpg') background-size: 100%

Maintain
reproducibility


Maintain reproducibility

--

# Save your package environment
snapshot_pkg()

# Compare package environment
compare_snapshot()

--

These two functions allow you to save and compare the packages used during the project. Use this if you want to make sure that others with whom you share the codebase have the same setup*.

.bottom-text[ *More info about how the functions work in documentation. ]


class: center, middle

Final thoughts


Goals

--

--

--


Testers wanted

--

--


class: middle, center

Ideas, bugs?

--

Please write an issue on https://github.com/pearsonplc/pearsonverse/issues


class: middle, center

Questions?


class: no-page-number background-image: url('img/final.jpg') background-size: 100%



pearsonplc/pearsonverse documentation built on May 30, 2019, 3:45 p.m.