Yo Your First R Package in in 30 30 Min inutes Jay Lee Yo - - PowerPoint PPT Presentation

yo your first r package in in 30 30 min inutes
SMART_READER_LITE
LIVE PREVIEW

Yo Your First R Package in in 30 30 Min inutes Jay Lee Yo - - PowerPoint PPT Presentation

Yo Your First R Package in in 30 30 Min inutes Jay Lee Yo Your First R Package in in 90 90 Min inutes? Jay Lee Re Reminders! install.packages(devtools) install.packages(roxygen2) RStudio (latest preferred, but ok if


slide-1
SLIDE 1

Yo Your First R Package in in 30 30 Min inutes

Jay Lee

slide-2
SLIDE 2

Yo Your First R Package in in 90 90 Min inutes?

Jay Lee

slide-3
SLIDE 3

Re Reminders!

install.packages(“devtools”) install.packages(“roxygen2”) RStudio (latest preferred, but ok if not) Screenshots: https://joongsup.rbind.io/slides/r_pkg_devel.html

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 3

slide-4
SLIDE 4

Ag Agenda enda

About/Not About Motivation R Code Reuse Workflow/Structure/Share Let’s Create Your First R Package! QnA

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 4

slide-5
SLIDE 5

About About

Bare Minimum Data Analysis RStudio on Mac Your Workflow Keyboard shortcuts

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 5

slide-6
SLIDE 6

No Not Abo t About ut

Full Scale Data Engineering Syntax Tests Vignettes

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 6

slide-7
SLIDE 7

Why y R Package?

Better organization of R functions Better documentation Better project structure/workflow All cool kids are using it

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 7

slide-8
SLIDE 8

St Start rt Si Simple

Plots 2 lines of ggplot codes to more complex R code reuse basic R pkg devel to more complex

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 8

slide-9
SLIDE 9

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 9

slide-10
SLIDE 10

Su Succe ccess ss Cri riteri ria

20 (talk audience) x 0.5 (% using copy/paste) x 0.6 (lucky half) x 0.5 = 3

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 10

slide-11
SLIDE 11

A Chea A Cheat S t Shee heet

Create an R package Project from RStudio Change project options to use roxygen2 Delete R/hello.R, man/hello.Rd, and (default) NAMESPACE Iterate through: write/load/document/check/install Build source and share

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 11

slide-12
SLIDE 12

Workf kflow

Write (cmd-shift-N) Load (cmd-shift-L) Document (cmd-shift-D) ChEck (cmd-shift-E) Install (cmd-shift-B)

Write Load Document Check Install (Build)

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 12

slide-13
SLIDE 13

St Stru ruct cture

R/ man/ DESCRIPTION

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 13

slide-14
SLIDE 14

Sh Share

(cmd-shift-B) è Personal (Build Source/Local) è Coworkers

Install.packages(“local/path/to/src”, repos = NULL)

(Build Source/Github) è Strangers

remotes::install_github(“author/repo”)

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 14

slide-15
SLIDE 15

Let’s Do It!

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 15

slide-16
SLIDE 16

Re Reminders!

install.packages(“devtools”) install.packages(“roxygen2”) RStudio (latest preferred, but ok if not) Screenshots: https://joongsup.rbind.io/slides/r_pkg_devel.html

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 16

slide-17
SLIDE 17

A Chea A Cheat S t Shee heet

Create an R package Project from RStudio Change project options to use roxygen2 Delete R/hello.R, man/hello.Rd, and (default) NAMESPACE Iterate through: write/load/document/check/install Build source and share

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 17

slide-18
SLIDE 18

Workf kflow

Write (cmd-shift-N) Load (cmd-shift-L) Document (cmd-shift-D) ChEck (cmd-shift-E) Install (cmd-shift-B)

Write Load Document Check Install (Build)

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 18

slide-19
SLIDE 19

Wha What Ne t Next? t?

Identify commonly used operations Write functions Document them (if anything, for future you!) Put them in a package Extend the use of R package (e.g., tests, vignettes, blog, tweet, etc.) For extra credit, consider submitting to CRAN! (only if applicable)

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 19

slide-20
SLIDE 20

Re References

https://joongsup.rbind.io/slides/r_pkg_devel.html http://r-pkgs.had.co.nz/ http://r-pkgs.org/ https://github.com/forwards/workshops/tree/master/Chicago2019 https://whattheyforgot.org/index.html https://www.rstudio.com/resources/videos/you-can-make-a-package-in-20-minutes/ http://tinyheero.github.io/jekyll/update/2015/07/26/making-your-first-R-package.html https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/ http://rmflight.github.io/post/analyses-as-packages/

3/18/19 https://joongsup.rbind.io/slides/r_pkg_devel.html 20