[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
SlideShare a Scribd company logo
November 2010
Hadley Wickham
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
Making an R package
Tuesday, 9 November 2010
https://github.com/
hadley/devtools/wiki
What I’ve learned from developing 20+ R packages
Tuesday, 9 November 2010
1. Getting started
2. Development cycle
3. Documentation
4. What to learn next
W
arning:
opinionated
advice
Tuesday, 9 November 2010
Use a mac! (or linux)
Otherwise, start by downloading and installing
http://www.murdoch-sutherland.com/Rtools/
Tuesday, 9 November 2010
Getting
started
Tuesday, 9 November 2010
1. Decide on a name
(stringr)
2. Create stringr/ and
stringr/R/
directories
3. Copy in your existing
code
!"" R
#   !"" file1.r
#   !"" file2.r
Tuesday, 9 November 2010
4. Add a description file
!"" DESCRIPTION
!"" R
Tuesday, 9 November 2010
Package: stringr
Type: Package
Title: Make it easier to work with strings.
Version: 0.5
Author: Hadley Wickham <h.wickham@gmail.com>
Maintainer: Hadley Wickham <h.wickham@gmail.com>
Description: stringr is a set of simple wrappers that make R's string
functions more consistent, simpler and easier to use. It does this
by ensuring that: function and argument names (and positions) are
consistent, all functions deal with NA's and zero length character
appropriately, and the output data structures from each function
matches the input data structures of other functions.
Imports: plyr
Depends: R (>= 2.11.0)
Suggests: testthat (>= 0.3)
License: GPL-2
https://github.com/hadley/devtools/wiki/Package-basics
Tuesday, 9 November 2010
4. Document your files
5. Run roxygenize()
!"" DESCRIPTION
!"" man
!"" R
Tuesday, 9 November 2010
#' The length of a string (in characters).
#'
#' @param string input character vector
#' @return numeric vector giving number of characters in
#' each element of the character vector. Missing strings have
#' missing length.
#' @keywords character
#' @seealso code{link{nchar}} which this function wraps
#' @export
#' @examples
#' str_length(letters)
#' str_length(c("i", "like", "programming", NA))
str_length <- function(string) {
string <- check_string(string)
nc <- nchar(string, allowNA = TRUE)
is.na(nc) <- is.na(string)
nc
}
https://github.com/hadley/devtools/wiki/docs-function
Tuesday, 9 November 2010
6. Run R CMD check
7. Use R CMD build to
create a package file
8. Upload file to CRAN:
ftp -u ftp://cran.R-
project.org/incoming/
stringr_0.5.tar.gz
!"" DESCRIPTION
!"" man
!"" R
https://github.com/hadley/devtools/wiki/Release
Tuesday, 9 November 2010
You’re done!
Tuesday, 9 November 2010
Development
cycle
Tuesday, 9 November 2010
Modify and
save code
Reload in R
Does it work?
Identify the
task
Write an
automated testYES
NO
Exploratory programming
Tuesday, 9 November 2010
Confirmatory programming
Modify and
save code
Reload in R
Does it work?
Write an
automated test
YES
NO
You’re done
Tuesday, 9 November 2010
# These patterns are facilitated by the devtools
# package: https://github.com/hadley/devtools
# Once installed and set up you can easily:
# * Reload code and data
load_all("stringr")
# * Run automated tests
test("stringr")
# * Update documentation
document("stringr")
Tuesday, 9 November 2010
Documentation
Tuesday, 9 November 2010
Documentation
Function-level: gives precise details
about individual functions
Package-level: gives details about how
to use the functions to solve real
(complex) problems.
Both are essential!
Tuesday, 9 November 2010
Function-level
Keep code and documentation close
together with roxygen.
Writing documentation gets easier with
time!
Tuesday, 9 November 2010
Package-level
Package help topic
NEWS
Vignettes + CITATION
Demos
README
https://github.com/hadley/devtools/wiki/docs-package
Tuesday, 9 November 2010
Next...
Tuesday, 9 November 2010
Learning more
Testing
Namespaces
Code style
Git + github
Tuesday, 9 November 2010
Learn from others
Read the source of other packages!
https://github.com/hadley/plyr
https://github.com/hadley/stringr
https://github.com/hadley/lubridate
https://github.com/hadley/evaluate
https://github.com/hadley/reshape
Tuesday, 9 November 2010
Tuesday, 9 November 2010
This work is licensed under the Creative
Commons Attribution-Noncommercial 3.0 United
States License. To view a copy of this license,
visit http://creativecommons.org/licenses/by-nc/
3.0/us/ or send a letter to Creative Commons,
171 Second Street, Suite 300, San Francisco,
California, 94105, USA.
Tuesday, 9 November 2010

More Related Content

What's hot (20)

Python & jupyter notebook installation
Python & jupyter notebook installationPython & jupyter notebook installation
Python & jupyter notebook installation
Anamta Sayyed
 
Introduction to Basics of Python
Introduction to Basics of PythonIntroduction to Basics of Python
Introduction to Basics of Python
Elewayte
 
What is Python JSON | Edureka
What is Python JSON | EdurekaWhat is Python JSON | Edureka
What is Python JSON | Edureka
Edureka!
 
Language design and translation issues
Language design and translation issuesLanguage design and translation issues
Language design and translation issues
Dr. SURBHI SAROHA
 
Chapter 10 data handling
Chapter 10 data handlingChapter 10 data handling
Chapter 10 data handling
Praveen M Jigajinni
 
Introduction To Python
Introduction To PythonIntroduction To Python
Introduction To Python
Vanessa Rene
 
C++ vs python the best ever comparison
C++ vs python the best ever comparison C++ vs python the best ever comparison
C++ vs python the best ever comparison
calltutors
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
Binsent Ribera
 
19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity
Intro C# Book
 
Error and exception in python
Error and exception in pythonError and exception in python
Error and exception in python
junnubabu
 
R programming presentation
R programming presentationR programming presentation
R programming presentation
Akshat Sharma
 
Natural Language Processing in AI
Natural Language Processing in AINatural Language Processing in AI
Natural Language Processing in AI
Saurav Shrestha
 
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Edureka!
 
Matplotlib Review 2021
Matplotlib Review 2021Matplotlib Review 2021
Matplotlib Review 2021
Bhaskar J.Roy
 
Python-Functions.pptx
Python-Functions.pptxPython-Functions.pptx
Python-Functions.pptx
Karudaiyar Ganapathy
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming
KrishnaMildain
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
Python Debugging Fundamentals
Python Debugging FundamentalsPython Debugging Fundamentals
Python Debugging Fundamentals
cbcunc
 
Full Python in 20 slides
Full Python in 20 slidesFull Python in 20 slides
Full Python in 20 slides
rfojdar
 
Python course syllabus
Python course syllabusPython course syllabus
Python course syllabus
Sugantha T
 
Python & jupyter notebook installation
Python & jupyter notebook installationPython & jupyter notebook installation
Python & jupyter notebook installation
Anamta Sayyed
 
Introduction to Basics of Python
Introduction to Basics of PythonIntroduction to Basics of Python
Introduction to Basics of Python
Elewayte
 
What is Python JSON | Edureka
What is Python JSON | EdurekaWhat is Python JSON | Edureka
What is Python JSON | Edureka
Edureka!
 
Language design and translation issues
Language design and translation issuesLanguage design and translation issues
Language design and translation issues
Dr. SURBHI SAROHA
 
Introduction To Python
Introduction To PythonIntroduction To Python
Introduction To Python
Vanessa Rene
 
C++ vs python the best ever comparison
C++ vs python the best ever comparison C++ vs python the best ever comparison
C++ vs python the best ever comparison
calltutors
 
19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity
Intro C# Book
 
Error and exception in python
Error and exception in pythonError and exception in python
Error and exception in python
junnubabu
 
R programming presentation
R programming presentationR programming presentation
R programming presentation
Akshat Sharma
 
Natural Language Processing in AI
Natural Language Processing in AINatural Language Processing in AI
Natural Language Processing in AI
Saurav Shrestha
 
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Edureka!
 
Matplotlib Review 2021
Matplotlib Review 2021Matplotlib Review 2021
Matplotlib Review 2021
Bhaskar J.Roy
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming
KrishnaMildain
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
Python Debugging Fundamentals
Python Debugging FundamentalsPython Debugging Fundamentals
Python Debugging Fundamentals
cbcunc
 
Full Python in 20 slides
Full Python in 20 slidesFull Python in 20 slides
Full Python in 20 slides
rfojdar
 
Python course syllabus
Python course syllabusPython course syllabus
Python course syllabus
Sugantha T
 

Viewers also liked (20)

Getting to Know Your Data with R
Getting to Know Your Data with RGetting to Know Your Data with R
Getting to Know Your Data with R
Stephen Withington
 
24 modelling
24 modelling24 modelling
24 modelling
Hadley Wickham
 
Correlations, Trends, and Outliers in ggplot2
Correlations, Trends, and Outliers in ggplot2Correlations, Trends, and Outliers in ggplot2
Correlations, Trends, and Outliers in ggplot2
Chris Rucker
 
16 Sequences
16 Sequences16 Sequences
16 Sequences
Hadley Wickham
 
20 date-times
20 date-times20 date-times
20 date-times
Hadley Wickham
 
04 Wrapup
04 Wrapup04 Wrapup
04 Wrapup
Hadley Wickham
 
21 spam
21 spam21 spam
21 spam
Hadley Wickham
 
Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)
Hadley Wickham
 
03 Conditional
03 Conditional03 Conditional
03 Conditional
Hadley Wickham
 
Graphical inference
Graphical inferenceGraphical inference
Graphical inference
Hadley Wickham
 
Insight Data Engineering: Open source data ingestion
Insight Data Engineering: Open source data ingestionInsight Data Engineering: Open source data ingestion
Insight Data Engineering: Open source data ingestion
Treasure Data, Inc.
 
03 Modelling
03 Modelling03 Modelling
03 Modelling
Hadley Wickham
 
R workshop iii -- 3 hours to learn ggplot2 series
R workshop iii -- 3 hours to learn ggplot2 seriesR workshop iii -- 3 hours to learn ggplot2 series
R workshop iii -- 3 hours to learn ggplot2 series
Vivian S. Zhang
 
23 data-structures
23 data-structures23 data-structures
23 data-structures
Hadley Wickham
 
02 Ddply
02 Ddply02 Ddply
02 Ddply
Hadley Wickham
 
01 Intro
01 Intro01 Intro
01 Intro
Hadley Wickham
 
Analyzing Data With Python
Analyzing Data With PythonAnalyzing Data With Python
Analyzing Data With Python
Sarah Guido
 
Reshaping Data in R
Reshaping Data in RReshaping Data in R
Reshaping Data in R
Jeffrey Breen
 
pandas - Python Data Analysis
pandas - Python Data Analysispandas - Python Data Analysis
pandas - Python Data Analysis
Andrew Henshaw
 
Machine learning in R
Machine learning in RMachine learning in R
Machine learning in R
apolol92
 
Getting to Know Your Data with R
Getting to Know Your Data with RGetting to Know Your Data with R
Getting to Know Your Data with R
Stephen Withington
 
Correlations, Trends, and Outliers in ggplot2
Correlations, Trends, and Outliers in ggplot2Correlations, Trends, and Outliers in ggplot2
Correlations, Trends, and Outliers in ggplot2
Chris Rucker
 
Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)
Hadley Wickham
 
Insight Data Engineering: Open source data ingestion
Insight Data Engineering: Open source data ingestionInsight Data Engineering: Open source data ingestion
Insight Data Engineering: Open source data ingestion
Treasure Data, Inc.
 
R workshop iii -- 3 hours to learn ggplot2 series
R workshop iii -- 3 hours to learn ggplot2 seriesR workshop iii -- 3 hours to learn ggplot2 series
R workshop iii -- 3 hours to learn ggplot2 series
Vivian S. Zhang
 
Analyzing Data With Python
Analyzing Data With PythonAnalyzing Data With Python
Analyzing Data With Python
Sarah Guido
 
pandas - Python Data Analysis
pandas - Python Data Analysispandas - Python Data Analysis
pandas - Python Data Analysis
Andrew Henshaw
 
Machine learning in R
Machine learning in RMachine learning in R
Machine learning in R
apolol92
 

Similar to R packages (20)

06 data
06 data06 data
06 data
Hadley Wickham
 
Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010
Matt Aimonetti
 
How to ReadTheDocs
How to ReadTheDocsHow to ReadTheDocs
How to ReadTheDocs
John Costa
 
Language-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible researchLanguage-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible research
Andrew Lowe
 
R Introduction
R IntroductionR Introduction
R Introduction
schamber
 
Will iPython replace bash?
Will iPython replace bash?Will iPython replace bash?
Will iPython replace bash?
Roberto Polli
 
Will iPython replace Bash?
Will iPython replace Bash?Will iPython replace Bash?
Will iPython replace Bash?
Babel
 
R brownbag seminar 2.2
R brownbag seminar  2.2R brownbag seminar  2.2
R brownbag seminar 2.2
Muhammad Nabi Ahmad
 
Rusted Ruby
Rusted RubyRusted Ruby
Rusted Ruby
Ian Pointer
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
gslicraf
 
Sinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящееSinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящее
.toster
 
The UNIX philosophy
The UNIX philosophyThe UNIX philosophy
The UNIX philosophy
Kevin Maiyo
 
Python_book.pdf
Python_book.pdfPython_book.pdf
Python_book.pdf
Dharmendra Jain
 
Python
PythonPython
Python
Praveen Konduru
 
Python
PythonPython
Python
JAVAID AHMAD WANI
 
Python
PythonPython
Python
prasad1ncc
 
Data analysis in R
Data analysis in RData analysis in R
Data analysis in R
Andrew Lowe
 
Scalable Plone hosting with Amazon EC2 for Rice University's Rhaptos open lea...
Scalable Plone hosting with Amazon EC2 for Rice University's Rhaptos open lea...Scalable Plone hosting with Amazon EC2 for Rice University's Rhaptos open lea...
Scalable Plone hosting with Amazon EC2 for Rice University's Rhaptos open lea...
Jazkarta, Inc.
 
If you have a problem, if no one else can help... and if you can find them, m...
If you have a problem, if no one else can help... and if you can find them, m...If you have a problem, if no one else can help... and if you can find them, m...
If you have a problem, if no one else can help... and if you can find them, m...
bitcoder
 
Scaling DevOps
Scaling DevOpsScaling DevOps
Scaling DevOps
Jeffrey Hulten
 
Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010
Matt Aimonetti
 
How to ReadTheDocs
How to ReadTheDocsHow to ReadTheDocs
How to ReadTheDocs
John Costa
 
Language-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible researchLanguage-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible research
Andrew Lowe
 
R Introduction
R IntroductionR Introduction
R Introduction
schamber
 
Will iPython replace bash?
Will iPython replace bash?Will iPython replace bash?
Will iPython replace bash?
Roberto Polli
 
Will iPython replace Bash?
Will iPython replace Bash?Will iPython replace Bash?
Will iPython replace Bash?
Babel
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
gslicraf
 
Sinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящееSinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящее
.toster
 
The UNIX philosophy
The UNIX philosophyThe UNIX philosophy
The UNIX philosophy
Kevin Maiyo
 
Data analysis in R
Data analysis in RData analysis in R
Data analysis in R
Andrew Lowe
 
Scalable Plone hosting with Amazon EC2 for Rice University's Rhaptos open lea...
Scalable Plone hosting with Amazon EC2 for Rice University's Rhaptos open lea...Scalable Plone hosting with Amazon EC2 for Rice University's Rhaptos open lea...
Scalable Plone hosting with Amazon EC2 for Rice University's Rhaptos open lea...
Jazkarta, Inc.
 
If you have a problem, if no one else can help... and if you can find them, m...
If you have a problem, if no one else can help... and if you can find them, m...If you have a problem, if no one else can help... and if you can find them, m...
If you have a problem, if no one else can help... and if you can find them, m...
bitcoder
 

More from Hadley Wickham (20)

27 development
27 development27 development
27 development
Hadley Wickham
 
27 development
27 development27 development
27 development
Hadley Wickham
 
22 spam
22 spam22 spam
22 spam
Hadley Wickham
 
19 tables
19 tables19 tables
19 tables
Hadley Wickham
 
18 cleaning
18 cleaning18 cleaning
18 cleaning
Hadley Wickham
 
17 polishing
17 polishing17 polishing
17 polishing
Hadley Wickham
 
16 critique
16 critique16 critique
16 critique
Hadley Wickham
 
15 time-space
15 time-space15 time-space
15 time-space
Hadley Wickham
 
14 case-study
14 case-study14 case-study
14 case-study
Hadley Wickham
 
13 case-study
13 case-study13 case-study
13 case-study
Hadley Wickham
 
12 adv-manip
12 adv-manip12 adv-manip
12 adv-manip
Hadley Wickham
 
11 adv-manip
11 adv-manip11 adv-manip
11 adv-manip
Hadley Wickham
 
11 adv-manip
11 adv-manip11 adv-manip
11 adv-manip
Hadley Wickham
 
10 simulation
10 simulation10 simulation
10 simulation
Hadley Wickham
 
10 simulation
10 simulation10 simulation
10 simulation
Hadley Wickham
 
09 bootstrapping
09 bootstrapping09 bootstrapping
09 bootstrapping
Hadley Wickham
 
08 functions
08 functions08 functions
08 functions
Hadley Wickham
 
07 problem-solving
07 problem-solving07 problem-solving
07 problem-solving
Hadley Wickham
 
05 subsetting
05 subsetting05 subsetting
05 subsetting
Hadley Wickham
 
04 reports
04 reports04 reports
04 reports
Hadley Wickham
 

Recently uploaded (20)

DealBook of Ukraine: 2025 edition | AVentures Capital
DealBook of Ukraine: 2025 edition | AVentures CapitalDealBook of Ukraine: 2025 edition | AVentures Capital
DealBook of Ukraine: 2025 edition | AVentures Capital
Yevgen Sysoyev
 
Fl studio crack version 12.9 Free Download
Fl studio crack version 12.9 Free DownloadFl studio crack version 12.9 Free Download
Fl studio crack version 12.9 Free Download
kherorpacca127
 
Field Device Management Market Report 2030 - TechSci Research
Field Device Management Market Report 2030 - TechSci ResearchField Device Management Market Report 2030 - TechSci Research
Field Device Management Market Report 2030 - TechSci Research
Vipin Mishra
 
DevNexus - Building 10x Development Organizations.pdf
DevNexus - Building 10x Development Organizations.pdfDevNexus - Building 10x Development Organizations.pdf
DevNexus - Building 10x Development Organizations.pdf
Justin Reock
 
Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4
Margaret Maynard-Reid
 
UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2
DianaGray10
 
EaseUS Partition Master Crack 2025 + Serial Key
EaseUS Partition Master Crack 2025 + Serial KeyEaseUS Partition Master Crack 2025 + Serial Key
EaseUS Partition Master Crack 2025 + Serial Key
kherorpacca127
 
MIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND Revenue Release Quarter 4 2024 - Finacial PresentationMIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND CTI
 
Understanding Traditional AI with Custom Vision & MuleSoft.pptx
Understanding Traditional AI with Custom Vision & MuleSoft.pptxUnderstanding Traditional AI with Custom Vision & MuleSoft.pptx
Understanding Traditional AI with Custom Vision & MuleSoft.pptx
shyamraj55
 
World Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a CrossroadsWorld Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a Crossroads
Joshua Randall
 
What Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI AgentsWhat Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI Agents
Zilliz
 
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
ScyllaDB
 
Revolutionizing-Government-Communication-The-OSWAN-Success-Story
Revolutionizing-Government-Communication-The-OSWAN-Success-StoryRevolutionizing-Government-Communication-The-OSWAN-Success-Story
Revolutionizing-Government-Communication-The-OSWAN-Success-Story
ssuser52ad5e
 
UiPath Agentic Automation Capabilities and Opportunities
UiPath Agentic Automation Capabilities and OpportunitiesUiPath Agentic Automation Capabilities and Opportunities
UiPath Agentic Automation Capabilities and Opportunities
DianaGray10
 
Backstage Software Templates for Java Developers
Backstage Software Templates for Java DevelopersBackstage Software Templates for Java Developers
Backstage Software Templates for Java Developers
Markus Eisele
 
BoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is DynamicBoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is Dynamic
Ortus Solutions, Corp
 
Brave Browser Crack 1.45.133 Activated 2025
Brave Browser Crack 1.45.133 Activated 2025Brave Browser Crack 1.45.133 Activated 2025
Brave Browser Crack 1.45.133 Activated 2025
kherorpacca00126
 
Unlocking DevOps Secuirty :Vault & Keylock
Unlocking DevOps Secuirty :Vault & KeylockUnlocking DevOps Secuirty :Vault & Keylock
Unlocking DevOps Secuirty :Vault & Keylock
HusseinMalikMammadli
 
L01 Introduction to Nanoindentation - What is hardness
L01 Introduction to Nanoindentation - What is hardnessL01 Introduction to Nanoindentation - What is hardness
L01 Introduction to Nanoindentation - What is hardness
RostislavDaniel
 
UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1
DianaGray10
 
DealBook of Ukraine: 2025 edition | AVentures Capital
DealBook of Ukraine: 2025 edition | AVentures CapitalDealBook of Ukraine: 2025 edition | AVentures Capital
DealBook of Ukraine: 2025 edition | AVentures Capital
Yevgen Sysoyev
 
Fl studio crack version 12.9 Free Download
Fl studio crack version 12.9 Free DownloadFl studio crack version 12.9 Free Download
Fl studio crack version 12.9 Free Download
kherorpacca127
 
Field Device Management Market Report 2030 - TechSci Research
Field Device Management Market Report 2030 - TechSci ResearchField Device Management Market Report 2030 - TechSci Research
Field Device Management Market Report 2030 - TechSci Research
Vipin Mishra
 
DevNexus - Building 10x Development Organizations.pdf
DevNexus - Building 10x Development Organizations.pdfDevNexus - Building 10x Development Organizations.pdf
DevNexus - Building 10x Development Organizations.pdf
Justin Reock
 
Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4
Margaret Maynard-Reid
 
UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2
DianaGray10
 
EaseUS Partition Master Crack 2025 + Serial Key
EaseUS Partition Master Crack 2025 + Serial KeyEaseUS Partition Master Crack 2025 + Serial Key
EaseUS Partition Master Crack 2025 + Serial Key
kherorpacca127
 
MIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND Revenue Release Quarter 4 2024 - Finacial PresentationMIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND CTI
 
Understanding Traditional AI with Custom Vision & MuleSoft.pptx
Understanding Traditional AI with Custom Vision & MuleSoft.pptxUnderstanding Traditional AI with Custom Vision & MuleSoft.pptx
Understanding Traditional AI with Custom Vision & MuleSoft.pptx
shyamraj55
 
World Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a CrossroadsWorld Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a Crossroads
Joshua Randall
 
What Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI AgentsWhat Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI Agents
Zilliz
 
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
ScyllaDB
 
Revolutionizing-Government-Communication-The-OSWAN-Success-Story
Revolutionizing-Government-Communication-The-OSWAN-Success-StoryRevolutionizing-Government-Communication-The-OSWAN-Success-Story
Revolutionizing-Government-Communication-The-OSWAN-Success-Story
ssuser52ad5e
 
UiPath Agentic Automation Capabilities and Opportunities
UiPath Agentic Automation Capabilities and OpportunitiesUiPath Agentic Automation Capabilities and Opportunities
UiPath Agentic Automation Capabilities and Opportunities
DianaGray10
 
Backstage Software Templates for Java Developers
Backstage Software Templates for Java DevelopersBackstage Software Templates for Java Developers
Backstage Software Templates for Java Developers
Markus Eisele
 
BoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is DynamicBoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is Dynamic
Ortus Solutions, Corp
 
Brave Browser Crack 1.45.133 Activated 2025
Brave Browser Crack 1.45.133 Activated 2025Brave Browser Crack 1.45.133 Activated 2025
Brave Browser Crack 1.45.133 Activated 2025
kherorpacca00126
 
Unlocking DevOps Secuirty :Vault & Keylock
Unlocking DevOps Secuirty :Vault & KeylockUnlocking DevOps Secuirty :Vault & Keylock
Unlocking DevOps Secuirty :Vault & Keylock
HusseinMalikMammadli
 
L01 Introduction to Nanoindentation - What is hardness
L01 Introduction to Nanoindentation - What is hardnessL01 Introduction to Nanoindentation - What is hardness
L01 Introduction to Nanoindentation - What is hardness
RostislavDaniel
 
UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1
DianaGray10
 

R packages

  • 1. November 2010 Hadley Wickham Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University Making an R package Tuesday, 9 November 2010
  • 2. https://github.com/ hadley/devtools/wiki What I’ve learned from developing 20+ R packages Tuesday, 9 November 2010
  • 3. 1. Getting started 2. Development cycle 3. Documentation 4. What to learn next W arning: opinionated advice Tuesday, 9 November 2010
  • 4. Use a mac! (or linux) Otherwise, start by downloading and installing http://www.murdoch-sutherland.com/Rtools/ Tuesday, 9 November 2010
  • 6. 1. Decide on a name (stringr) 2. Create stringr/ and stringr/R/ directories 3. Copy in your existing code !"" R #   !"" file1.r #   !"" file2.r Tuesday, 9 November 2010
  • 7. 4. Add a description file !"" DESCRIPTION !"" R Tuesday, 9 November 2010
  • 8. Package: stringr Type: Package Title: Make it easier to work with strings. Version: 0.5 Author: Hadley Wickham <h.wickham@gmail.com> Maintainer: Hadley Wickham <h.wickham@gmail.com> Description: stringr is a set of simple wrappers that make R's string functions more consistent, simpler and easier to use. It does this by ensuring that: function and argument names (and positions) are consistent, all functions deal with NA's and zero length character appropriately, and the output data structures from each function matches the input data structures of other functions. Imports: plyr Depends: R (>= 2.11.0) Suggests: testthat (>= 0.3) License: GPL-2 https://github.com/hadley/devtools/wiki/Package-basics Tuesday, 9 November 2010
  • 9. 4. Document your files 5. Run roxygenize() !"" DESCRIPTION !"" man !"" R Tuesday, 9 November 2010
  • 10. #' The length of a string (in characters). #' #' @param string input character vector #' @return numeric vector giving number of characters in #' each element of the character vector. Missing strings have #' missing length. #' @keywords character #' @seealso code{link{nchar}} which this function wraps #' @export #' @examples #' str_length(letters) #' str_length(c("i", "like", "programming", NA)) str_length <- function(string) { string <- check_string(string) nc <- nchar(string, allowNA = TRUE) is.na(nc) <- is.na(string) nc } https://github.com/hadley/devtools/wiki/docs-function Tuesday, 9 November 2010
  • 11. 6. Run R CMD check 7. Use R CMD build to create a package file 8. Upload file to CRAN: ftp -u ftp://cran.R- project.org/incoming/ stringr_0.5.tar.gz !"" DESCRIPTION !"" man !"" R https://github.com/hadley/devtools/wiki/Release Tuesday, 9 November 2010
  • 12. You’re done! Tuesday, 9 November 2010
  • 14. Modify and save code Reload in R Does it work? Identify the task Write an automated testYES NO Exploratory programming Tuesday, 9 November 2010
  • 15. Confirmatory programming Modify and save code Reload in R Does it work? Write an automated test YES NO You’re done Tuesday, 9 November 2010
  • 16. # These patterns are facilitated by the devtools # package: https://github.com/hadley/devtools # Once installed and set up you can easily: # * Reload code and data load_all("stringr") # * Run automated tests test("stringr") # * Update documentation document("stringr") Tuesday, 9 November 2010
  • 18. Documentation Function-level: gives precise details about individual functions Package-level: gives details about how to use the functions to solve real (complex) problems. Both are essential! Tuesday, 9 November 2010
  • 19. Function-level Keep code and documentation close together with roxygen. Writing documentation gets easier with time! Tuesday, 9 November 2010
  • 20. Package-level Package help topic NEWS Vignettes + CITATION Demos README https://github.com/hadley/devtools/wiki/docs-package Tuesday, 9 November 2010
  • 22. Learning more Testing Namespaces Code style Git + github Tuesday, 9 November 2010
  • 23. Learn from others Read the source of other packages! https://github.com/hadley/plyr https://github.com/hadley/stringr https://github.com/hadley/lubridate https://github.com/hadley/evaluate https://github.com/hadley/reshape Tuesday, 9 November 2010
  • 25. This work is licensed under the Creative Commons Attribution-Noncommercial 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/ 3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. Tuesday, 9 November 2010