SlideShare a Scribd company logo
1 of 15
Download to read offline
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
Preparing and submitting a package to CRAN
Adwave
Jean Sanderson
Sheffield R Users Group
16 June 2015
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
Adwave
Work with Bioinformatics Group at Massey University
Wavelet analysis of genomic data to reconstruct population ancestry
Related method released software as set of R functions
http://bioinf.eva.mpg.de/download/StepPCO/
Reconstructing Past Admixture Processes from Local Genomic Ancestry
Using Wavelet Transformation, Genetics (available as early online)
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
Steps to creating R package
1 Prepare R code
2 Create package files
3 Build package
Linux
Windows
4 Submit to CRAN
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
Preparing the R code
adwave contains:
3 functions
signal
wavesum
plotsignal
An example data set, admix
Downsampled version of example in the paper so that examples run quickly
Code that you plan on sharing takes a bit more work
Foolproof code (input checks etc)
Think about nice names for functions, output etc
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
package.skeleton
modifying files
adding dependencies
Creating package using package.skeleton
Open R and source R code and data
Use package.skeleton
> ls()
[1] "admix" "plotsignal" "signal" "wavesum"
> package.skeleton(name="adwave")
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in ’./adwave/Read-and-delete-me’.
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
package.skeleton
modifying files
adding dependencies
Creating package using package.skeleton
The following folders and files have been created
data
- admix.RDA
man (help files)
- admix.Rd
- adwave-package.Rd
- plotsignal.Rd
- signal.Rd
- wavesum.Rd
R
- plotsignal.R
- signal.R
- wavesum.R
DESCRIPTION
NAMESPACE
Read-and-delete
Prepare the DESCRIPTION, and .Rd files in text editor
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
package.skeleton
modifying files
adding dependencies
DESCRIPTION
Package: adwave
Type: Package
Title: Wavelet Analysis of Genomic Data from Admixed Populations
Version: 1.0
Date: 2014-10-03
Depends: waveslim
Author: Jean Sanderson
Maintainer: Murray Cox <m.p.cox@massey.ac.nz>
Description: Implements wavelet-based approaches for describing ...
License: GPL (>=2)
}
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
package.skeleton
modifying files
adding dependencies
signal.Rd
name{signal}
alias{signal}
title{Compute Localized Admixture Signals}
description{Produces estimates of localized ancestry. }
usage{ signal(table, who = colnames(table), ...)}
arguments{
item{table}{matrix of genotype calls.}
item{who}{individuals to include in the analysis.}
}
details{Applies PCA to genome-wide data using ...}
references{For further details, see accompanying paper.}
author{Jean Sanderson}
seealso{code{link{wavesum}}, code{link{plotsignal}}}
examples{
# EXAMPLE 1.
# Generate the admixture signal
AdexPCA <- signal(admix$data,popA="popA",popB="popB")
}
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
package.skeleton
modifying files
adding dependencies
List any dependencies
adwave uses the waveslim package.
Alter the DESCRIPTION file to contain
Depends: waveslim
Alter the NAMESPACE file to contain
import(waveslim)
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
installing tools
compiling
Setting up the computer (windows)
Download and install tools
1 Rtools: ‘collection of resources for building packages for R under
Microsoft Window’
http://cran.us.r-project.org/bin/windows/Rtools/
2 MikTex
3 HTML help workshop
4 Extra tools? (C, C++, Fortran)
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
installing tools
compiling
Setting up the computer (windows)
Set PATH variable so computer knows where to locate Rtools.
C:Rtoolsbin;C:Rtoolsgcc-4.6.3bin; C:Program FilesRR-3.0.1bin;
C:Program FilesRR-3.0.1binx64;C:Rbatch;C:Program FilesCommon FilesMicrosoft SharedWindows Live;
C:Program Files (x86)Common FilesMicrosoft SharedWindows Live;C:WindowsUsystem32;
C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;
C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;
C:Program Files (x86)IntelServicesIPT;C:Program Files (x86)Windows LiveShared;
C:Program Files (x86)MiKTeX 2.9miktexbin
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
installing tools
compiling
After all the hard work...
1 Place formatted files somewhere suitable e.g.
C:UsersjeanDocumentsRpackagesbuild_adwave_07102014
2 Run command prompt as administrator
Right click on icon in Start menu and ‘run as administrator’
Check that R is linked by typing ‘R’. If it runs ok then exit, otherwise.... ?
Navigate one directory up from where the package folder resides. i.e.
cd C:UsersjeanDocumentsRpackagesbuild_adwave_07102014
3 To build, type
R CMD build adwave
This produces the file adwave_1.0.tar.
Recommends using command R CMD build -- resave-data adwave
4 To check the package, type
R CMD check adwave
If it doesn’t finish successfully, go back and fix the errors (and warnings)!
Particularly important if you submit to CRAN
5 To install the package, type
R CMD INSTALL adwave
Creates folder C:UsersjeanDocumentsRwin-library3.1
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
Submit to CRAN?
http://cran.r-project.org/submit.html
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
Submitting the package
Attempt 1: Example took too long to run
Attempt 2: Incorrect punctuation
Third time lucky!
Make sure that the package has passed all the checks with no warnings and
you’ve followed all the formatting advice exactly.
http://cran.r-project.org/doc/manuals/r-release/R-exts.html
Preparing and submitting a package to CRAN
Preparing R code
Creating package files
Building and checking the package
Submitting to CRAN
Finished product
Preparing and submitting a package to CRAN

More Related Content

Similar to Preparing R code for CRAN submission

Reproducibility with Checkpoint & RRO - NYC R Conference
Reproducibility with Checkpoint & RRO - NYC R ConferenceReproducibility with Checkpoint & RRO - NYC R Conference
Reproducibility with Checkpoint & RRO - NYC R ConferenceRevolution Analytics
 
Reproducibility with Checkpoint & RRO
Reproducibility with Checkpoint & RROReproducibility with Checkpoint & RRO
Reproducibility with Checkpoint & RROWork-Bench
 
DockerCon EU 2015: Shipping Manifests, Bill of Lading and Docker Metadata and...
DockerCon EU 2015: Shipping Manifests, Bill of Lading and Docker Metadata and...DockerCon EU 2015: Shipping Manifests, Bill of Lading and Docker Metadata and...
DockerCon EU 2015: Shipping Manifests, Bill of Lading and Docker Metadata and...Docker, Inc.
 
Approaching package manager
Approaching package managerApproaching package manager
Approaching package managerTimur Safin
 
What We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
What We Learned Building an R-Python Hybrid Predictive Analytics PipelineWhat We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
What We Learned Building an R-Python Hybrid Predictive Analytics PipelineWork-Bench
 
A Handbook Of Statistical Analyses Using R
A Handbook Of Statistical Analyses Using RA Handbook Of Statistical Analyses Using R
A Handbook Of Statistical Analyses Using RNicole Adams
 
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...Work-Bench
 
Introduction to Data Mining with R and Data Import/Export in R
Introduction to Data Mining with R and Data Import/Export in RIntroduction to Data Mining with R and Data Import/Export in R
Introduction to Data Mining with R and Data Import/Export in RYanchang Zhao
 
Null Dubai Humla_Romansh_Yadav_Android_app_pentesting
Null Dubai Humla_Romansh_Yadav_Android_app_pentestingNull Dubai Humla_Romansh_Yadav_Android_app_pentesting
Null Dubai Humla_Romansh_Yadav_Android_app_pentestingRomansh Yadav
 
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...Patrick Chanezon
 
Generating Linked Data descriptions of Debian packages in the Debian PTS
Generating Linked Data descriptions of Debian packages in the Debian PTSGenerating Linked Data descriptions of Debian packages in the Debian PTS
Generating Linked Data descriptions of Debian packages in the Debian PTSolberger
 
DEF CON 27 - workshop - ISAAC EVANS - discover exploit and eradicate entire v...
DEF CON 27 - workshop - ISAAC EVANS - discover exploit and eradicate entire v...DEF CON 27 - workshop - ISAAC EVANS - discover exploit and eradicate entire v...
DEF CON 27 - workshop - ISAAC EVANS - discover exploit and eradicate entire v...Felipe Prado
 
R Programming: Introduction To R Packages
R Programming: Introduction To R PackagesR Programming: Introduction To R Packages
R Programming: Introduction To R PackagesRsquared Academy
 
Building a Linux IPv6 DNS Server Project review PPT v3.0 First review
Building a Linux IPv6 DNS Server Project review PPT v3.0 First reviewBuilding a Linux IPv6 DNS Server Project review PPT v3.0 First review
Building a Linux IPv6 DNS Server Project review PPT v3.0 First reviewHari
 
stackconf 2021 | Continuous Security – integrating security into your pipelines
stackconf 2021 | Continuous Security – integrating security into your pipelinesstackconf 2021 | Continuous Security – integrating security into your pipelines
stackconf 2021 | Continuous Security – integrating security into your pipelinesNETWAYS
 

Similar to Preparing R code for CRAN submission (20)

Reproducibility with Checkpoint & RRO - NYC R Conference
Reproducibility with Checkpoint & RRO - NYC R ConferenceReproducibility with Checkpoint & RRO - NYC R Conference
Reproducibility with Checkpoint & RRO - NYC R Conference
 
Reproducibility with Checkpoint & RRO
Reproducibility with Checkpoint & RROReproducibility with Checkpoint & RRO
Reproducibility with Checkpoint & RRO
 
R development
R developmentR development
R development
 
DockerCon EU 2015: Shipping Manifests, Bill of Lading and Docker Metadata and...
DockerCon EU 2015: Shipping Manifests, Bill of Lading and Docker Metadata and...DockerCon EU 2015: Shipping Manifests, Bill of Lading and Docker Metadata and...
DockerCon EU 2015: Shipping Manifests, Bill of Lading and Docker Metadata and...
 
Approaching package manager
Approaching package managerApproaching package manager
Approaching package manager
 
Devtools cheatsheet
Devtools cheatsheetDevtools cheatsheet
Devtools cheatsheet
 
Devtools cheatsheet
Devtools cheatsheetDevtools cheatsheet
Devtools cheatsheet
 
Native Hadoop with prebuilt spark
Native Hadoop with prebuilt sparkNative Hadoop with prebuilt spark
Native Hadoop with prebuilt spark
 
What We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
What We Learned Building an R-Python Hybrid Predictive Analytics PipelineWhat We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
What We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
 
A Handbook Of Statistical Analyses Using R
A Handbook Of Statistical Analyses Using RA Handbook Of Statistical Analyses Using R
A Handbook Of Statistical Analyses Using R
 
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...
 
Introduction to Data Mining with R and Data Import/Export in R
Introduction to Data Mining with R and Data Import/Export in RIntroduction to Data Mining with R and Data Import/Export in R
Introduction to Data Mining with R and Data Import/Export in R
 
Null Dubai Humla_Romansh_Yadav_Android_app_pentesting
Null Dubai Humla_Romansh_Yadav_Android_app_pentestingNull Dubai Humla_Romansh_Yadav_Android_app_pentesting
Null Dubai Humla_Romansh_Yadav_Android_app_pentesting
 
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
 
Generating Linked Data descriptions of Debian packages in the Debian PTS
Generating Linked Data descriptions of Debian packages in the Debian PTSGenerating Linked Data descriptions of Debian packages in the Debian PTS
Generating Linked Data descriptions of Debian packages in the Debian PTS
 
DEF CON 27 - workshop - ISAAC EVANS - discover exploit and eradicate entire v...
DEF CON 27 - workshop - ISAAC EVANS - discover exploit and eradicate entire v...DEF CON 27 - workshop - ISAAC EVANS - discover exploit and eradicate entire v...
DEF CON 27 - workshop - ISAAC EVANS - discover exploit and eradicate entire v...
 
R Programming: Introduction To R Packages
R Programming: Introduction To R PackagesR Programming: Introduction To R Packages
R Programming: Introduction To R Packages
 
Ankur_Srivastava
Ankur_SrivastavaAnkur_Srivastava
Ankur_Srivastava
 
Building a Linux IPv6 DNS Server Project review PPT v3.0 First review
Building a Linux IPv6 DNS Server Project review PPT v3.0 First reviewBuilding a Linux IPv6 DNS Server Project review PPT v3.0 First review
Building a Linux IPv6 DNS Server Project review PPT v3.0 First review
 
stackconf 2021 | Continuous Security – integrating security into your pipelines
stackconf 2021 | Continuous Security – integrating security into your pipelinesstackconf 2021 | Continuous Security – integrating security into your pipelines
stackconf 2021 | Continuous Security – integrating security into your pipelines
 

More from Paul Richards

Introduction to knitr - May Sheffield R Users group
Introduction to knitr - May Sheffield R Users groupIntroduction to knitr - May Sheffield R Users group
Introduction to knitr - May Sheffield R Users groupPaul Richards
 
Querying open data with R - Talk at April SheffieldR Users Gp
Querying open data with R - Talk at April SheffieldR Users GpQuerying open data with R - Talk at April SheffieldR Users Gp
Querying open data with R - Talk at April SheffieldR Users GpPaul Richards
 
OrienteeRing - using R to optimise mini mountain marathon routes - Pete Dodd ...
OrienteeRing - using R to optimise mini mountain marathon routes - Pete Dodd ...OrienteeRing - using R to optimise mini mountain marathon routes - Pete Dodd ...
OrienteeRing - using R to optimise mini mountain marathon routes - Pete Dodd ...Paul Richards
 
Phylogeny in R - Bianca Santini Sheffield R Users March 2015
Phylogeny in R - Bianca Santini Sheffield R Users March 2015Phylogeny in R - Bianca Santini Sheffield R Users March 2015
Phylogeny in R - Bianca Santini Sheffield R Users March 2015Paul Richards
 
Intro to ggplot2 - Sheffield R Users Group, Feb 2015
Intro to ggplot2 - Sheffield R Users Group, Feb 2015Intro to ggplot2 - Sheffield R Users Group, Feb 2015
Intro to ggplot2 - Sheffield R Users Group, Feb 2015Paul Richards
 
Introduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RIntroduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RPaul Richards
 
Sheffield R Jan 2015 - Using R to investigate parasite infections in Asian el...
Sheffield R Jan 2015 - Using R to investigate parasite infections in Asian el...Sheffield R Jan 2015 - Using R to investigate parasite infections in Asian el...
Sheffield R Jan 2015 - Using R to investigate parasite infections in Asian el...Paul Richards
 
Introduction to data.table in R
Introduction to data.table in RIntroduction to data.table in R
Introduction to data.table in RPaul Richards
 

More from Paul Richards (9)

Introduction to knitr - May Sheffield R Users group
Introduction to knitr - May Sheffield R Users groupIntroduction to knitr - May Sheffield R Users group
Introduction to knitr - May Sheffield R Users group
 
Querying open data with R - Talk at April SheffieldR Users Gp
Querying open data with R - Talk at April SheffieldR Users GpQuerying open data with R - Talk at April SheffieldR Users Gp
Querying open data with R - Talk at April SheffieldR Users Gp
 
OrienteeRing - using R to optimise mini mountain marathon routes - Pete Dodd ...
OrienteeRing - using R to optimise mini mountain marathon routes - Pete Dodd ...OrienteeRing - using R to optimise mini mountain marathon routes - Pete Dodd ...
OrienteeRing - using R to optimise mini mountain marathon routes - Pete Dodd ...
 
Phylogeny in R - Bianca Santini Sheffield R Users March 2015
Phylogeny in R - Bianca Santini Sheffield R Users March 2015Phylogeny in R - Bianca Santini Sheffield R Users March 2015
Phylogeny in R - Bianca Santini Sheffield R Users March 2015
 
Intro to ggplot2 - Sheffield R Users Group, Feb 2015
Intro to ggplot2 - Sheffield R Users Group, Feb 2015Intro to ggplot2 - Sheffield R Users Group, Feb 2015
Intro to ggplot2 - Sheffield R Users Group, Feb 2015
 
Introduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RIntroduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in R
 
Sheffield R Jan 2015 - Using R to investigate parasite infections in Asian el...
Sheffield R Jan 2015 - Using R to investigate parasite infections in Asian el...Sheffield R Jan 2015 - Using R to investigate parasite infections in Asian el...
Sheffield R Jan 2015 - Using R to investigate parasite infections in Asian el...
 
Introduction to data.table in R
Introduction to data.table in RIntroduction to data.table in R
Introduction to data.table in R
 
Dplyr and Plyr
Dplyr and PlyrDplyr and Plyr
Dplyr and Plyr
 

Recently uploaded

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 

Recently uploaded (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 

Preparing R code for CRAN submission

  • 1. Preparing R code Creating package files Building and checking the package Submitting to CRAN Preparing and submitting a package to CRAN Adwave Jean Sanderson Sheffield R Users Group 16 June 2015 Preparing and submitting a package to CRAN
  • 2. Preparing R code Creating package files Building and checking the package Submitting to CRAN Adwave Work with Bioinformatics Group at Massey University Wavelet analysis of genomic data to reconstruct population ancestry Related method released software as set of R functions http://bioinf.eva.mpg.de/download/StepPCO/ Reconstructing Past Admixture Processes from Local Genomic Ancestry Using Wavelet Transformation, Genetics (available as early online) Preparing and submitting a package to CRAN
  • 3. Preparing R code Creating package files Building and checking the package Submitting to CRAN Steps to creating R package 1 Prepare R code 2 Create package files 3 Build package Linux Windows 4 Submit to CRAN Preparing and submitting a package to CRAN
  • 4. Preparing R code Creating package files Building and checking the package Submitting to CRAN Preparing the R code adwave contains: 3 functions signal wavesum plotsignal An example data set, admix Downsampled version of example in the paper so that examples run quickly Code that you plan on sharing takes a bit more work Foolproof code (input checks etc) Think about nice names for functions, output etc Preparing and submitting a package to CRAN
  • 5. Preparing R code Creating package files Building and checking the package Submitting to CRAN package.skeleton modifying files adding dependencies Creating package using package.skeleton Open R and source R code and data Use package.skeleton > ls() [1] "admix" "plotsignal" "signal" "wavesum" > package.skeleton(name="adwave") Creating directories ... Creating DESCRIPTION ... Creating NAMESPACE ... Creating Read-and-delete-me ... Saving functions and data ... Making help files ... Done. Further steps are described in ’./adwave/Read-and-delete-me’. Preparing and submitting a package to CRAN
  • 6. Preparing R code Creating package files Building and checking the package Submitting to CRAN package.skeleton modifying files adding dependencies Creating package using package.skeleton The following folders and files have been created data - admix.RDA man (help files) - admix.Rd - adwave-package.Rd - plotsignal.Rd - signal.Rd - wavesum.Rd R - plotsignal.R - signal.R - wavesum.R DESCRIPTION NAMESPACE Read-and-delete Prepare the DESCRIPTION, and .Rd files in text editor Preparing and submitting a package to CRAN
  • 7. Preparing R code Creating package files Building and checking the package Submitting to CRAN package.skeleton modifying files adding dependencies DESCRIPTION Package: adwave Type: Package Title: Wavelet Analysis of Genomic Data from Admixed Populations Version: 1.0 Date: 2014-10-03 Depends: waveslim Author: Jean Sanderson Maintainer: Murray Cox <m.p.cox@massey.ac.nz> Description: Implements wavelet-based approaches for describing ... License: GPL (>=2) } Preparing and submitting a package to CRAN
  • 8. Preparing R code Creating package files Building and checking the package Submitting to CRAN package.skeleton modifying files adding dependencies signal.Rd name{signal} alias{signal} title{Compute Localized Admixture Signals} description{Produces estimates of localized ancestry. } usage{ signal(table, who = colnames(table), ...)} arguments{ item{table}{matrix of genotype calls.} item{who}{individuals to include in the analysis.} } details{Applies PCA to genome-wide data using ...} references{For further details, see accompanying paper.} author{Jean Sanderson} seealso{code{link{wavesum}}, code{link{plotsignal}}} examples{ # EXAMPLE 1. # Generate the admixture signal AdexPCA <- signal(admix$data,popA="popA",popB="popB") } Preparing and submitting a package to CRAN
  • 9. Preparing R code Creating package files Building and checking the package Submitting to CRAN package.skeleton modifying files adding dependencies List any dependencies adwave uses the waveslim package. Alter the DESCRIPTION file to contain Depends: waveslim Alter the NAMESPACE file to contain import(waveslim) Preparing and submitting a package to CRAN
  • 10. Preparing R code Creating package files Building and checking the package Submitting to CRAN installing tools compiling Setting up the computer (windows) Download and install tools 1 Rtools: ‘collection of resources for building packages for R under Microsoft Window’ http://cran.us.r-project.org/bin/windows/Rtools/ 2 MikTex 3 HTML help workshop 4 Extra tools? (C, C++, Fortran) Preparing and submitting a package to CRAN
  • 11. Preparing R code Creating package files Building and checking the package Submitting to CRAN installing tools compiling Setting up the computer (windows) Set PATH variable so computer knows where to locate Rtools. C:Rtoolsbin;C:Rtoolsgcc-4.6.3bin; C:Program FilesRR-3.0.1bin; C:Program FilesRR-3.0.1binx64;C:Rbatch;C:Program FilesCommon FilesMicrosoft SharedWindows Live; C:Program Files (x86)Common FilesMicrosoft SharedWindows Live;C:WindowsUsystem32; C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0; C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon; C:Program Files (x86)IntelServicesIPT;C:Program Files (x86)Windows LiveShared; C:Program Files (x86)MiKTeX 2.9miktexbin Preparing and submitting a package to CRAN
  • 12. Preparing R code Creating package files Building and checking the package Submitting to CRAN installing tools compiling After all the hard work... 1 Place formatted files somewhere suitable e.g. C:UsersjeanDocumentsRpackagesbuild_adwave_07102014 2 Run command prompt as administrator Right click on icon in Start menu and ‘run as administrator’ Check that R is linked by typing ‘R’. If it runs ok then exit, otherwise.... ? Navigate one directory up from where the package folder resides. i.e. cd C:UsersjeanDocumentsRpackagesbuild_adwave_07102014 3 To build, type R CMD build adwave This produces the file adwave_1.0.tar. Recommends using command R CMD build -- resave-data adwave 4 To check the package, type R CMD check adwave If it doesn’t finish successfully, go back and fix the errors (and warnings)! Particularly important if you submit to CRAN 5 To install the package, type R CMD INSTALL adwave Creates folder C:UsersjeanDocumentsRwin-library3.1 Preparing and submitting a package to CRAN
  • 13. Preparing R code Creating package files Building and checking the package Submitting to CRAN Submit to CRAN? http://cran.r-project.org/submit.html Preparing and submitting a package to CRAN
  • 14. Preparing R code Creating package files Building and checking the package Submitting to CRAN Submitting the package Attempt 1: Example took too long to run Attempt 2: Incorrect punctuation Third time lucky! Make sure that the package has passed all the checks with no warnings and you’ve followed all the formatting advice exactly. http://cran.r-project.org/doc/manuals/r-release/R-exts.html Preparing and submitting a package to CRAN
  • 15. Preparing R code Creating package files Building and checking the package Submitting to CRAN Finished product Preparing and submitting a package to CRAN