[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)

Koalas: Making an Easy Transition from Pandas to Apache Spark
Koalas: Making an Easy Transition from Pandas to Apache SparkKoalas: Making an Easy Transition from Pandas to Apache Spark
Koalas: Making an Easy Transition from Pandas to Apache Spark
Databricks
 
A simple intro to clustering basics.pdf
A simple intro to clustering basics.pdfA simple intro to clustering basics.pdf
A simple intro to clustering basics.pdf
FERNWEH3
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
Harshad Patil
 
Chapter 11 cluster advanced, Han & Kamber
Chapter 11 cluster advanced, Han & KamberChapter 11 cluster advanced, Han & Kamber
Chapter 11 cluster advanced, Han & Kamber
Houw Liong The
 
Solr Graph Query: Presented by Kevin Watters, KMW Technology
Solr Graph Query: Presented by Kevin Watters, KMW TechnologySolr Graph Query: Presented by Kevin Watters, KMW Technology
Solr Graph Query: Presented by Kevin Watters, KMW Technology
Lucidworks
 
Data mining with Weka
Data mining with WekaData mining with Weka
Data mining with Weka
AlbanLevy
 
Service Discovery in Prometheus
Service Discovery in PrometheusService Discovery in Prometheus
Service Discovery in Prometheus
Oliver Moser
 
On-boarding with JanusGraph Performance
On-boarding with JanusGraph PerformanceOn-boarding with JanusGraph Performance
On-boarding with JanusGraph Performance
Chin Huang
 
kafka
kafkakafka
kafka
Amikam Snir
 
MySQL.pptx
MySQL.pptxMySQL.pptx
MySQL.pptx
SHAQORPRO
 
Getting the most out of MariaDB MaxScale
Getting the most out of MariaDB MaxScaleGetting the most out of MariaDB MaxScale
Getting the most out of MariaDB MaxScale
MariaDB plc
 
Quarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniquesQuarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniques
Red Hat Developers
 
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Frederic Descamps
 
In the DOM, no one will hear you scream
In the DOM, no one will hear you screamIn the DOM, no one will hear you scream
In the DOM, no one will hear you scream
Mario Heiderich
 
Apache Spark—Apache HBase Connector: Feature Rich and Efficient Access to HBa...
Apache Spark—Apache HBase Connector: Feature Rich and Efficient Access to HBa...Apache Spark—Apache HBase Connector: Feature Rich and Efficient Access to HBa...
Apache Spark—Apache HBase Connector: Feature Rich and Efficient Access to HBa...
Spark Summit
 
Scylla Summit 2022: New AWS Instances Perfect for ScyllaDB
Scylla Summit 2022: New AWS Instances Perfect for ScyllaDBScylla Summit 2022: New AWS Instances Perfect for ScyllaDB
Scylla Summit 2022: New AWS Instances Perfect for ScyllaDB
ScyllaDB
 
Introduction to Vagrant
Introduction to VagrantIntroduction to Vagrant
Introduction to Vagrant
Marcelo Pinheiro
 
Semmle Codeql
Semmle Codeql Semmle Codeql
Semmle Codeql
M. S.
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Philip Schwarz
 
Kafka streams 20201012
Kafka streams 20201012Kafka streams 20201012
Kafka streams 20201012
한 경만
 
Koalas: Making an Easy Transition from Pandas to Apache Spark
Koalas: Making an Easy Transition from Pandas to Apache SparkKoalas: Making an Easy Transition from Pandas to Apache Spark
Koalas: Making an Easy Transition from Pandas to Apache Spark
Databricks
 
A simple intro to clustering basics.pdf
A simple intro to clustering basics.pdfA simple intro to clustering basics.pdf
A simple intro to clustering basics.pdf
FERNWEH3
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
Harshad Patil
 
Chapter 11 cluster advanced, Han & Kamber
Chapter 11 cluster advanced, Han & KamberChapter 11 cluster advanced, Han & Kamber
Chapter 11 cluster advanced, Han & Kamber
Houw Liong The
 
Solr Graph Query: Presented by Kevin Watters, KMW Technology
Solr Graph Query: Presented by Kevin Watters, KMW TechnologySolr Graph Query: Presented by Kevin Watters, KMW Technology
Solr Graph Query: Presented by Kevin Watters, KMW Technology
Lucidworks
 
Data mining with Weka
Data mining with WekaData mining with Weka
Data mining with Weka
AlbanLevy
 
Service Discovery in Prometheus
Service Discovery in PrometheusService Discovery in Prometheus
Service Discovery in Prometheus
Oliver Moser
 
On-boarding with JanusGraph Performance
On-boarding with JanusGraph PerformanceOn-boarding with JanusGraph Performance
On-boarding with JanusGraph Performance
Chin Huang
 
Getting the most out of MariaDB MaxScale
Getting the most out of MariaDB MaxScaleGetting the most out of MariaDB MaxScale
Getting the most out of MariaDB MaxScale
MariaDB plc
 
Quarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniquesQuarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniques
Red Hat Developers
 
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Frederic Descamps
 
In the DOM, no one will hear you scream
In the DOM, no one will hear you screamIn the DOM, no one will hear you scream
In the DOM, no one will hear you scream
Mario Heiderich
 
Apache Spark—Apache HBase Connector: Feature Rich and Efficient Access to HBa...
Apache Spark—Apache HBase Connector: Feature Rich and Efficient Access to HBa...Apache Spark—Apache HBase Connector: Feature Rich and Efficient Access to HBa...
Apache Spark—Apache HBase Connector: Feature Rich and Efficient Access to HBa...
Spark Summit
 
Scylla Summit 2022: New AWS Instances Perfect for ScyllaDB
Scylla Summit 2022: New AWS Instances Perfect for ScyllaDBScylla Summit 2022: New AWS Instances Perfect for ScyllaDB
Scylla Summit 2022: New AWS Instances Perfect for ScyllaDB
ScyllaDB
 
Semmle Codeql
Semmle Codeql Semmle Codeql
Semmle Codeql
M. S.
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Philip Schwarz
 
Kafka streams 20201012
Kafka streams 20201012Kafka streams 20201012
Kafka streams 20201012
한 경만
 

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)

[QUICK TALK] "Why Some Teams Grow Better Under Pressure", Oleksandr Marchenko...
[QUICK TALK] "Why Some Teams Grow Better Under Pressure", Oleksandr Marchenko...[QUICK TALK] "Why Some Teams Grow Better Under Pressure", Oleksandr Marchenko...
[QUICK TALK] "Why Some Teams Grow Better Under Pressure", Oleksandr Marchenko...
Fwdays
 
Français Patch Tuesday - Mars
Français Patch Tuesday - MarsFrançais Patch Tuesday - Mars
Français Patch Tuesday - Mars
Ivanti
 
WSO2Con 2025 - Architecting Cloud-Native Applications
WSO2Con 2025 - Architecting Cloud-Native ApplicationsWSO2Con 2025 - Architecting Cloud-Native Applications
WSO2Con 2025 - Architecting Cloud-Native Applications
WSO2
 
Solutions for Radiation Threats: The Zytekno Catalog
Solutions for Radiation Threats: The Zytekno CatalogSolutions for Radiation Threats: The Zytekno Catalog
Solutions for Radiation Threats: The Zytekno Catalog
omnicnc
 
"AI-Driven Automation for High-Performing Teams: Optimize Routine Tasks & Lea...
"AI-Driven Automation for High-Performing Teams: Optimize Routine Tasks & Lea..."AI-Driven Automation for High-Performing Teams: Optimize Routine Tasks & Lea...
"AI-Driven Automation for High-Performing Teams: Optimize Routine Tasks & Lea...
Fwdays
 
Digital twins as key enabler for innovation in IoT systems
Digital twins as key enabler for innovation in IoT systemsDigital twins as key enabler for innovation in IoT systems
Digital twins as key enabler for innovation in IoT systems
Daniel Lehner
 
Agentic AI in Action: Real-Time Vision, Memory & Autonomy with Browser Use & ...
Agentic AI in Action: Real-Time Vision, Memory & Autonomy with Browser Use & ...Agentic AI in Action: Real-Time Vision, Memory & Autonomy with Browser Use & ...
Agentic AI in Action: Real-Time Vision, Memory & Autonomy with Browser Use & ...
Zilliz
 
Ensuring AI Trust and Transparency with Inclusive Design
Ensuring AI Trust and Transparency with Inclusive Design Ensuring AI Trust and Transparency with Inclusive Design
Ensuring AI Trust and Transparency with Inclusive Design
Ted Drake
 
CXL Market Perspective: Get Ready for Adoption and Growth in 2025
CXL Market Perspective: Get Ready for Adoption and Growth in 2025CXL Market Perspective: Get Ready for Adoption and Growth in 2025
CXL Market Perspective: Get Ready for Adoption and Growth in 2025
AI Infra Forum
 
[NYC Scrum] 4 bad ideas about productivity... and what Agilists should do ins...
[NYC Scrum] 4 bad ideas about productivity... and what Agilists should do ins...[NYC Scrum] 4 bad ideas about productivity... and what Agilists should do ins...
[NYC Scrum] 4 bad ideas about productivity... and what Agilists should do ins...
Jason Yip
 
Essential Ad-hoc Commands in Ansible - RHCE.pdf
Essential Ad-hoc Commands in Ansible - RHCE.pdfEssential Ad-hoc Commands in Ansible - RHCE.pdf
Essential Ad-hoc Commands in Ansible - RHCE.pdf
RHCSA Guru
 
Landing Page A/B Testing with Melanie Bowles
Landing Page A/B Testing with Melanie BowlesLanding Page A/B Testing with Melanie Bowles
Landing Page A/B Testing with Melanie Bowles
Jason Packer
 
The Most Important Tech Innovations of 2024
The Most Important Tech Innovations of 2024The Most Important Tech Innovations of 2024
The Most Important Tech Innovations of 2024
Arif Efendi
 
Ultra Accelerator Link (UALink): Accelerator Scale-up Network
Ultra Accelerator Link (UALink): Accelerator Scale-up NetworkUltra Accelerator Link (UALink): Accelerator Scale-up Network
Ultra Accelerator Link (UALink): Accelerator Scale-up Network
AI Infra Forum
 
Measuring AI: Why benchmarks matter, and how to build the right ones
Measuring AI: Why benchmarks matter, and how to build the right onesMeasuring AI: Why benchmarks matter, and how to build the right ones
Measuring AI: Why benchmarks matter, and how to build the right ones
AI Infra Forum
 
Global AI Bootcamp 2025 - Sydney - Model Agnostic AI Implementation
Global  AI Bootcamp 2025 - Sydney - Model Agnostic AI ImplementationGlobal  AI Bootcamp 2025 - Sydney - Model Agnostic AI Implementation
Global AI Bootcamp 2025 - Sydney - Model Agnostic AI Implementation
Anupam Ranku
 
UIUX Design Course in Coimbatore with Internship
UIUX Design Course in Coimbatore with InternshipUIUX Design Course in Coimbatore with Internship
UIUX Design Course in Coimbatore with Internship
Nextskill Technologies
 
Blending AI in Enterprise Architecture.pdf
Blending AI in Enterprise Architecture.pdfBlending AI in Enterprise Architecture.pdf
Blending AI in Enterprise Architecture.pdf
Calvin Hendryx-Parker
 
STIG in Action: Continuous Compliance with MITRE & Anchore
STIG in Action: Continuous Compliance with MITRE & AnchoreSTIG in Action: Continuous Compliance with MITRE & Anchore
STIG in Action: Continuous Compliance with MITRE & Anchore
Anchore
 
vLLM: High-performance serving of LLMs using open-source technology
vLLM: High-performance serving of LLMs using open-source technologyvLLM: High-performance serving of LLMs using open-source technology
vLLM: High-performance serving of LLMs using open-source technology
AI Infra Forum
 
[QUICK TALK] "Why Some Teams Grow Better Under Pressure", Oleksandr Marchenko...
[QUICK TALK] "Why Some Teams Grow Better Under Pressure", Oleksandr Marchenko...[QUICK TALK] "Why Some Teams Grow Better Under Pressure", Oleksandr Marchenko...
[QUICK TALK] "Why Some Teams Grow Better Under Pressure", Oleksandr Marchenko...
Fwdays
 
Français Patch Tuesday - Mars
Français Patch Tuesday - MarsFrançais Patch Tuesday - Mars
Français Patch Tuesday - Mars
Ivanti
 
WSO2Con 2025 - Architecting Cloud-Native Applications
WSO2Con 2025 - Architecting Cloud-Native ApplicationsWSO2Con 2025 - Architecting Cloud-Native Applications
WSO2Con 2025 - Architecting Cloud-Native Applications
WSO2
 
Solutions for Radiation Threats: The Zytekno Catalog
Solutions for Radiation Threats: The Zytekno CatalogSolutions for Radiation Threats: The Zytekno Catalog
Solutions for Radiation Threats: The Zytekno Catalog
omnicnc
 
"AI-Driven Automation for High-Performing Teams: Optimize Routine Tasks & Lea...
"AI-Driven Automation for High-Performing Teams: Optimize Routine Tasks & Lea..."AI-Driven Automation for High-Performing Teams: Optimize Routine Tasks & Lea...
"AI-Driven Automation for High-Performing Teams: Optimize Routine Tasks & Lea...
Fwdays
 
Digital twins as key enabler for innovation in IoT systems
Digital twins as key enabler for innovation in IoT systemsDigital twins as key enabler for innovation in IoT systems
Digital twins as key enabler for innovation in IoT systems
Daniel Lehner
 
Agentic AI in Action: Real-Time Vision, Memory & Autonomy with Browser Use & ...
Agentic AI in Action: Real-Time Vision, Memory & Autonomy with Browser Use & ...Agentic AI in Action: Real-Time Vision, Memory & Autonomy with Browser Use & ...
Agentic AI in Action: Real-Time Vision, Memory & Autonomy with Browser Use & ...
Zilliz
 
Ensuring AI Trust and Transparency with Inclusive Design
Ensuring AI Trust and Transparency with Inclusive Design Ensuring AI Trust and Transparency with Inclusive Design
Ensuring AI Trust and Transparency with Inclusive Design
Ted Drake
 
CXL Market Perspective: Get Ready for Adoption and Growth in 2025
CXL Market Perspective: Get Ready for Adoption and Growth in 2025CXL Market Perspective: Get Ready for Adoption and Growth in 2025
CXL Market Perspective: Get Ready for Adoption and Growth in 2025
AI Infra Forum
 
[NYC Scrum] 4 bad ideas about productivity... and what Agilists should do ins...
[NYC Scrum] 4 bad ideas about productivity... and what Agilists should do ins...[NYC Scrum] 4 bad ideas about productivity... and what Agilists should do ins...
[NYC Scrum] 4 bad ideas about productivity... and what Agilists should do ins...
Jason Yip
 
Essential Ad-hoc Commands in Ansible - RHCE.pdf
Essential Ad-hoc Commands in Ansible - RHCE.pdfEssential Ad-hoc Commands in Ansible - RHCE.pdf
Essential Ad-hoc Commands in Ansible - RHCE.pdf
RHCSA Guru
 
Landing Page A/B Testing with Melanie Bowles
Landing Page A/B Testing with Melanie BowlesLanding Page A/B Testing with Melanie Bowles
Landing Page A/B Testing with Melanie Bowles
Jason Packer
 
The Most Important Tech Innovations of 2024
The Most Important Tech Innovations of 2024The Most Important Tech Innovations of 2024
The Most Important Tech Innovations of 2024
Arif Efendi
 
Ultra Accelerator Link (UALink): Accelerator Scale-up Network
Ultra Accelerator Link (UALink): Accelerator Scale-up NetworkUltra Accelerator Link (UALink): Accelerator Scale-up Network
Ultra Accelerator Link (UALink): Accelerator Scale-up Network
AI Infra Forum
 
Measuring AI: Why benchmarks matter, and how to build the right ones
Measuring AI: Why benchmarks matter, and how to build the right onesMeasuring AI: Why benchmarks matter, and how to build the right ones
Measuring AI: Why benchmarks matter, and how to build the right ones
AI Infra Forum
 
Global AI Bootcamp 2025 - Sydney - Model Agnostic AI Implementation
Global  AI Bootcamp 2025 - Sydney - Model Agnostic AI ImplementationGlobal  AI Bootcamp 2025 - Sydney - Model Agnostic AI Implementation
Global AI Bootcamp 2025 - Sydney - Model Agnostic AI Implementation
Anupam Ranku
 
UIUX Design Course in Coimbatore with Internship
UIUX Design Course in Coimbatore with InternshipUIUX Design Course in Coimbatore with Internship
UIUX Design Course in Coimbatore with Internship
Nextskill Technologies
 
Blending AI in Enterprise Architecture.pdf
Blending AI in Enterprise Architecture.pdfBlending AI in Enterprise Architecture.pdf
Blending AI in Enterprise Architecture.pdf
Calvin Hendryx-Parker
 
STIG in Action: Continuous Compliance with MITRE & Anchore
STIG in Action: Continuous Compliance with MITRE & AnchoreSTIG in Action: Continuous Compliance with MITRE & Anchore
STIG in Action: Continuous Compliance with MITRE & Anchore
Anchore
 
vLLM: High-performance serving of LLMs using open-source technology
vLLM: High-performance serving of LLMs using open-source technologyvLLM: High-performance serving of LLMs using open-source technology
vLLM: High-performance serving of LLMs using open-source technology
AI Infra Forum
 

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