Writing Package Vignettes

Similar documents
Package knitcitations

administration access control A security feature that determines who can edit the configuration settings for a given Transmitter.

A Handbook of Statistical Analyses Using R. Brian S. Everitt and Torsten Hothorn

Package RSentiment. October 15, 2017

NENS 230 Assignment #2 Data Import, Manipulation, and Basic Plotting

The Joint Transportation Research Program & Purdue Library Publishing Services

Enhancing Music Maps

Inferno-ish R. Talk given 2012 May 29 at CambR in Cambridge UK. Pat Burns stat.com May

Text Analysis with R for Students of Literature

Migratory Patterns in IRs: CONTENTdm, Digital Commons and Flying the Coop

Package hcandersenr. January 20, 2019

Enabling Reproducible NGS Analysis Through Automated Jupyter Pipelines

LIST OF PUBLISHED STANDARDS

Using deltas to speed up SquashFS ebuild repository updates

(Slide1) POD and The Long Tail

Cinematography: Theory And Practice: Image Making For Cinematographers And Directors 2nd (second) Edition By Brown, Blain Published By Focal Press

Understanding Research Methods: An Overview Of The Essentials By Mildred L. Patten

Introduction To Modern Cryptography Jonathan Katz

Self-publishing services for book authors

Why Should I Recycle? (Why Should I? Books) By Jen Green

Image-to-Markup Generation with Coarse-to-Fine Attention

Audio Metering Measurements, Standards, and Practice (2 nd Edition) Eddy Bøgh Brixen

Migratory Patterns in IRs: CONTENTdm, Digital Commons and Flying the Coop

Dead Links? No Problem. We re In This Together

Modern Cryptography: Theory And Practice By Wenbo Mao

James Stewart Single Variable Calculus 7th Edition Pdf

Anastasia (Selections) By Robert Schultz READ ONLINE

Android Application Development For Dummies By Donn Felker

Better Business Graphics: Avoiding Death by Powerpoint Joe Levy

DIAGRAM LILYAN KRIS FILLMORE TRACKS DENOTATIVE CONNOTATIVE

Package colorpatch. June 10, 2017

Remote Application Update for the RCM33xx

ENGINEERING COMMITTEE Energy Management Subcommittee SCTE STANDARD SCTE

Literature Management with Perl and Emacs

Excel VBA Programming For Dummies (04) By Walkenbach, John [Paperback (2004)] By Walkenbach

EECS 140 Laboratory Exercise 7 PLD Programming

ALWD Citation Manual: A Professional System Of Citation, 3rd Edition By Association of Legal Writing Directors, DarDickerson

VLSI Design: 3) Explain the various MOSFET Capacitances & their significance. 4) Draw a CMOS Inverter. Explain its transfer characteristics

Seen on Screens: Viewing Canadian Feature Films on Multiple Platforms 2007 to April 2015

User Deposit Checklists

Written Tutorial and copyright 2016 by Open for free distribution as long as author acknowledgment remains.

Comparing Scholars Portal & ebrary e-book platforms

Read & Download (PDF Kindle) VBA And Macros For Microsoft Excel

Are you ready to Publish? Understanding the publishing process. Presenter: Andrea Hoogenkamp-OBrien

William Shakespeare - As You Like It By William Shakespeare READ ONLINE

BACK TO THE ORIGINAL: A GLANCE INCIDENCES OF WEB CITATIONS IN SOUTH AFRICAN ELECTRONIC LAW JOURNALS FROM 2005 TO 2012

4.1 GENERATION OF VIGNETTE TEXTS & RANDOM VIGNETTE SAMPLES

Package ForImp. R topics documented: February 19, Type Package. Title Imputation of Missing Values Through a Forward Imputation.

THE EMPEROR'S LAST ISLAND By Julia Blackburn

Steps in the Reference Interview p. 53 Opening the Interview p. 53 Negotiating the Question p. 54 The Search Process p. 57 Communicating the

Success Providing Excellent Service in a Changing World of Digital Information Resources: Collection Services at McGill

Self Publishing a (D) Book

Live And Learn By Niobia Bryant READ ONLINE

American History : A Survey 11th Edition By Brinkley, Alan Published By McGraw-Hill / McGraw-Hill Higher Education Hardcover

Practical Multivariate Analysis, Fifth Edition (Chapman & Hall/CRC Texts in Statistical Science)

Basic Research Methods For Librarians, 4th Edition (Library And Information Science Text) By Lynn Silipigni Connaway, Ronald R.

How The Body Works: A Comprehensive Illustrated Encyclopedia Of Anatomy By Peter Abrahams READ ONLINE


Frontier Taiwan: An Anthology Of Modern Chinese Poetry.: An Article From: World Literature Today [HTML] [Digital] By Jeffrey Twitchell-Waas

Prime Num Generator - Maker Faire 2014

From Inquiry To Academic Writing: A Text And Reader, 2016 MLA Update Edition By Stuart Greene, April Lidinsky

Econometrics For Dummies By Roberto Pedace

IASA TC 03 and TC 04: Standards Related to the Long Term Preservation and Digitisation of Sound Recordings

8K120 Projection Application

Manhattan In Maps: By Paul E. Cohen, Robert T. Augustyn

Read And Speak Arabic For Beginners By Jane Wightwick, Mahmoud Gaafar READ ONLINE

Drumset 101 (A Contemporary Approach To Playing The Drums) Book & CD By Dave Black & Steve Houghton

New Challenges : digital documents in the Library of the Friedrich-Ebert-Foundation, Bonn Rüdiger Zimmermann / Walter Wimmer

Mastering Communication At Work: How To Lead, Manage, And Influence (Business Books) By Ethan F. Becker, Jon Wortmann READ ONLINE

Cataloguing for the world: motivation, method and madness

Frequently Asked Questions

And You Thought the Printing Press was Important

Julius Caesar (Shakespeare For Young People) By William Shakespeare, Diane Davidson READ ONLINE

Effects of Civil War Pathfinder

NKJV, Apply The Word Study Bible, Hardcover, Red Letter Edition: Live In His Steps By Thomas Nelson READ ONLINE

The Organization and description of the UNLV archives

Crime Scene Investigation And Reconstruction (3rd Edition) By Robert R. Ogle Jr.

Guide To Publishing Your. CREATESPACE Book. Sarco2000 Fiverr Book Designer

The Poor Man's James Bond (vol. 1) By Kurt Saxon READ ONLINE

Transportation Process For BaBar

David Copperfield (French Edition) By Charles Dickens, P. Lorain READ ONLINE

DOWNLOAD OR READ : WRITING FOR THE KINDLE PDF EBOOK EPUB MOBI

OCLC Update. Cynthia Whitacre. John Chapman. Sandi Jones. Manager, WorldCat Quality & Partner Content. Product Manager, Metadata Services

LIBRARY RESOURCES FOR SUSTAINABILITY 100

EAGLE V6: GETTING STARTED GUIDE [PCB DESIGN] BY MITCHELL DUNCAN DOWNLOAD EBOOK : EAGLE V6: GETTING STARTED GUIDE [PCB DESIGN] BY MITCHELL DUNCAN PDF

StaMPS Persistent Scatterer Exercise

Information Networks

Mckay Western Society Study Guide Answers READ ONLINE

Data Acquisition Using LabVIEW

DOWNLOAD OR READ : WRITING FOR MULTIMEDIA AND THE WEB THIRD EDITION PDF EBOOK EPUB MOBI

FOR WWW TEACUPSOFTWARE COM User Guide

Phenopix - Exposure extraction

Developing Android on Android

LIO-8 Quick Start Guide

Case analysis: An IoT energy monitoring system for a PV connected residence

Open Access Publishing and arxiv. Tommy Ohlsson KTH Royal Institute of Technology

My Travel Journal: Color Suitcases, Travel Planner & Journal, 6 X 9, 139 Pages By My Travel Journal

UWE has obtained warranties from all depositors as to their title in the material deposited and as to their right to deposit such material.

Editing Your Reading List

Turning a Text List into Inkscape Text Objects

Transcription:

Writing Package Vignettes Duncan Murdoch Department of Statistical and Actuarial Sciences University of Western Ontario November 29, 2013 1 of 21

Outline 1 Why Write Packages? 2 What are Vignettes? 3 Mechanics of Writing Vignettes 4 How to Write a Good Vignette 2 of 21

Outline 1 Why Write Packages? 2 What are Vignettes? 3 Mechanics of Writing Vignettes 4 How to Write a Good Vignette 3 of 21

R is mostly packages! R ships with 13 base packages, and 15 recommended packages. CRAN contains about 5000 packages, Bioconductor has about 1600. There are other repositories (R-forge, Omegahat, rforge.net, etc.) and packages not in these repositories. 4 of 21

What is in a package? Permanent R objects: functions, data, etc. Help pages and vignettes documenting these objects. External code in C, C++, Fortran, Objective C, etc. to implement some of the functions, or link to external libraries or programs. Tests to help to keep the code working as R evolves. 5 of 21

Packages, libraries, repositories? We use > library(foo) to load the package and put it on the search list, but a package is not a library. A library is a collection of packages installed on your system. Use > dir.create("newlib") >.libpaths("newlib") to create a new one, and add it as the first place to look. A repository is a collection of packages like CRAN, usually available online. Use install.packages() to install a package from a repository into your library. 6 of 21

Not everyone uses packages Packages are great, but they aren t the only ways to save code and data. There are also binary images using save(), save.image() or q("yes") R scripts in plain text files 7 of 21

What s wrong with saving your workspace? Saved images are hard to work with: they are black boxes outside of R. It is very easy to save more than you intended, and get bloated saves, and unintended interactions. It is easy to forget how some objects were created. 8 of 21

Working with scripts and vignettes But... Scripts are easy to transport and edit on any platform. It is easy to see what s there (if you format your code nicely...) You can have a permanent record of how research results were produced. It is hard to re-use parts of scripts. Cut and paste is error prone. It is hard to remember which earlier part of a script needs to be re-executed, and which doesn t. 9 of 21

So why packages? Packages combine the good aspects of saved images and scripts. R packages can be distributed to others. R tools support quality control checks. 10 of 21

So why packages? Packages combine the good aspects of saved images and scripts. R packages can be distributed to others. R tools support quality control checks. Today s talk isn t about packages, it s about vignettes! 10 of 21

Outline 1 Why Write Packages? 2 What are Vignettes? 3 Mechanics of Writing Vignettes 4 How to Write a Good Vignette 11 of 21

What are Vignettes? They are not easy to define. 12 of 21

What are Vignettes? They are not easy to define. Up to the release of R 3.0.0, I could say that vignettes are Sweave documents included in a package and intended to document that package. 12 of 21

What are Vignettes? They are not easy to define. Up to the release of R 3.0.0, I could say that vignettes are Sweave documents included in a package and intended to document that package. Now they don t need to be Sweave! We can have vignettes from knitr (Xie, 2013) or other packages, and they can produce PDF or HTML output. 12 of 21

What are Vignettes? They are not easy to define. Up to the release of R 3.0.0, I could say that vignettes are Sweave documents included in a package and intended to document that package. Now they don t need to be Sweave! We can have vignettes from knitr (Xie, 2013) or other packages, and they can produce PDF or HTML output. 12 of 21

My current definition Vignettes are documentation in R packages that may include R code. The code is run when the vignette is woven, and the code can be extracted when the vignette is tangled. The vignette source is in the vignettes directory of the package. Vignettes are considered to be part of R s help system. The help system will display their title, and links to the PDF, source, and extracted R code. This is based on some special meta-data included in the source. 13 of 21

Outline 1 Why Write Packages? 2 What are Vignettes? 3 Mechanics of Writing Vignettes 4 How to Write a Good Vignette 14 of 21

Vignettes are usually Sweave documents If you put a.rnw file in the vignettes directory of a package, R will treat it as a vignette: 1 It will check for indexing and other meta-data. 2 It will process the file to convert it to a PDF (or HTML) file. 3 It will include the PDF file in the package when built. (Prior to 3.0.2, the vignette was included at installation time, not build time.) 15 of 21

Meta-data in Vignettes Meta-data looks like a L A T E X macro in a comment: %\VignetteIndexEntry{About the tables package} %\VignetteDepends{MASS} %\VignetteEngine{knitr::knitr} It is processed by R and ignored by L A T E X. 16 of 21

Non-Sweave vignettes To create a vignette using an engine other than Sweave, put the %\VignetteEngine{pkg::driver} line in the source file. Even if the vignette is not intended to be processed into L A T E X code, use this format. E.g. knitr allows vignettes to be written in Markdown, and puts the meta-data in a Markdown comment: <!-- %\VignetteEngine{knitr::knitr} %\VignetteIndexEntry{An R Markdown...} --> 17 of 21

Outline 1 Why Write Packages? 2 What are Vignettes? 3 Mechanics of Writing Vignettes 4 How to Write a Good Vignette 18 of 21

What are vignettes for? Vignettes document packages: They are the best way to present an overall introduction to a package. 19 of 21

What are vignettes for? Vignettes document packages: They are the best way to present an overall introduction to a package. They can give technical details about how a package was implemented. 19 of 21

What are vignettes for? Vignettes document packages: They are the best way to present an overall introduction to a package. They can give technical details about how a package was implemented. They can demonstrate particular aspects of the package. 19 of 21

What are vignettes for? Vignettes document packages: They are the best way to present an overall introduction to a package. They can give technical details about how a package was implemented. They can demonstrate particular aspects of the package. 19 of 21

What are vignettes not good for? It is not a good idea to include reference documentation in a vignette as tables (Murdoch, 2013) does. R has strong support to ensure that the regular help pages in packages are consistent with the code; there is no support to make sure the vignette stays consistent. 20 of 21

What are vignettes not good for? It is not a good idea to include reference documentation in a vignette as tables (Murdoch, 2013) does. R has strong support to ensure that the regular help pages in packages are consistent with the code; there is no support to make sure the vignette stays consistent. It is not a good idea to break up the documentation into too many small pieces (as grid does). Users will find it inconvenient to have to switch between too many files. 20 of 21

What are vignettes not good for? It is not a good idea to include reference documentation in a vignette as tables (Murdoch, 2013) does. R has strong support to ensure that the regular help pages in packages are consistent with the code; there is no support to make sure the vignette stays consistent. It is not a good idea to break up the documentation into too many small pieces (as grid does). Users will find it inconvenient to have to switch between too many files. HTML is a different medium than PDF, so it might make sense to have a lot of small HTML vignettes, with links to each other; these are very new and I don t have much experience using them. 20 of 21

What are vignettes not good for? It is not a good idea to include reference documentation in a vignette as tables (Murdoch, 2013) does. R has strong support to ensure that the regular help pages in packages are consistent with the code; there is no support to make sure the vignette stays consistent. It is not a good idea to break up the documentation into too many small pieces (as grid does). Users will find it inconvenient to have to switch between too many files. HTML is a different medium than PDF, so it might make sense to have a lot of small HTML vignettes, with links to each other; these are very new and I don t have much experience using them. 20 of 21

References Duncan Murdoch. tables: Formula-driven table generation, 2013. R package version 0.7.64, on CRAN. Yihui Xie. Dynamic Documents with R and knitr. Chapman and Hall/CRC, 2013. URL http://yihui.name/knitr/. ISBN 978-1482203530. 21 of 21