- I am an autodidact
- What I present here works for me
- Read and follow the official R Manuals for the truth
Markus Gesmann
Maintainer of the googleVis and ChainLadder packages
source
library
library(myPackage)
will load package functions into memoryWindows | OSX | Linux |
---|---|---|
R | R | R |
Rtools | XCode | Developer tools |
TeX | TeX | TeX |
Command Line Tools | ||
qpdf | qpdf | qpdf |
Check the RStudio page on Package Development Prerequisites for more details and download links.
R
is in your programme pathgunzip googleVis_0.x.y.tar.gz
tar xvf googleVis_0.x.y.tar
R CMD BUILD googleVis
R CMD CHECK googleVis_0.4.2.tar.gz
R CMD INSTALL googleVis_0.4.2.tar.gz
DESCRIPTION
NAMESPACE
R, man
data, demo
, vignettes, po
, exec, inst, tests
package.skeleton
from RPackage: HelloWorld
Type: Package
Title: What the package does (short line)
Version: 1.0
Date: 2013-05-05
Author: Who wrote it
Maintainer: Who to complain to <yourfault@somewhere.net>
Description: More about what it does (maybe more than one line)
License: What license is it under?
Package: googleVis
Type: Package
Title: Interface between R and the Google Chart Tools
Version: 0.4.2
Date: 2013-03-16
Authors@R: c(person("Markus", "Gesmann", role = c("aut", "cre"),
email = "markus.gesmann@gmail.com"),
person("Diego", "de Castillo", role = "aut",
email = "decastillo@gmail.com"),
person("Joe", "Cheng", role = "ctb",
email = "joe@rstudio.com"))
Description: The googleVis package provides ...
Depends: R (>= 2.11.0)
Imports: methods,RJSONIO,utils
Suggests: shiny (>= 0.4.0)
License: GPL (>= 2)
importFrom(grDevices)
importFrom(methods, setMethod)
importFrom(utils, packageDescription)
importFrom("RJSONIO", "toJSON")
# User functions
export(gvisMotionChart, gvisTable, gvisGeoMap,gvisTreeMap,gvisMap, gvisAnnotatedTimeLine)
export(gvisScatterChart, gvisPieChart, gvisOrgChart, gvisIntensityMap)
export(gvisLineChart, gvisAreaChart, gvisBarChart, gvisColumnChart, gvisGauge)
export(gvisGeoChart, gvisComboChart, gvisBubbleChart)
export(gvisCandlestickChart, gvisSteppedAreaChart)
export(gvisMerge, createGoogleGadget)
export(plot.gvis, renderGvis)
# Methods
S3method(plot, gvis)
S3method(print, gvis)
prompt(myfunction)
generates template help file for youman
directoryR CMD CHECK
checks that
hello <- function(name){paste("Hello", name)}
hello('World')
[1] "Hello World"
prompt(hello)
# Created file named ‘hello.Rd’.
# Edit the file and move it to the appropriate directory.
\name{hello}
\alias{hello}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
%% ~~function to do ... ~~
}
\description{
%% ~~ A concise (1-5 lines) description of what the function does. ~~
}
\usage{
hello(name)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
\item{name}{
%% ~~Describe \code{name} here~~
}
}
\details{
%% ~~ If necessary, more details than the description above ~~
}
\value{
%% ~Describe the value returned
%% If it is a LIST, use
%% \item{comp1 }{Description of 'comp1'}
%% \item{comp2 }{Description of 'comp2'}
%% ...
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%% ~~who you are~~
}
\note{
%% ~~further notes~~
}
%% ~Make other sections like Warning with \section{Warning }{....} ~
\seealso{
%% ~~objects to See Also as \code{\link{help}}, ~~~
}
\examples{
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (name)
{
paste("Hello", name)
}
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
R CMD BUILD
R CMD CHECK
R CMD INSTALL
roxygen2
extract the documentation and generate the Rd-filesroxyPackage
can generate a whole package from your R files
roxyPackage
vignette for more detailsHelloWorld
R
hello.R
in the R
folder#' Hello World function
#'
#' Say Hello
#'
#' This function is a basic Hello World function in R. It uses the
#' \code{\link{paste}} function to say hello to someone.
#'
#' @param name. Default is set to 'World'.
#' @author Markus Gesmann
#' @keywords print
#' @seealso \code{\link{paste}}
#' @export
#' @examples
#' hello()
#' hello(c("Alice", "Bob")
hello <- function(name="World"){
paste("Hello", name)
}
myDescription <- data.frame(
Package="HelloWorld",
Type="Package",
Title="Hello World",
Author="Markus Gesmann <markus.gesmann@gmail.com>",
Maintainer="Markus Gesmann <markus.gesmann@gmail.com>",
Depends="R (>= 2.10.0)",
Description="Hello World package",
License="GPL (>= 3)"
)
roxy.package
library(roxyPackage)
roxy.package(
pck.source.dir="~/Desktop/HelloWorld/",
R.libs="/Library/Frameworks/R.framework/Resources/library/",
repo.root="~/Desktop/repo",
pck.version="0.1",
pck.description=myDescription,
actions=c("roxy", "doc", "html", "package", "check")
)
00Index
is required, which lists the R files with a short description00Index
file of googleVisgoogleVis Examples of various googleVis functions and plots
AnimatedGeoMap Prototype of an animate a geo map with JavaScript
EventListener Examples of basic JavaScript event handlers
WorldBank Visualising country level data sourced from the World Bank
Rrsp Demo showing how googleVis can work with the R.rsp package
vignettes
folder are build automaticallyzzz.R
inst\shiny
inst\rsp
library(slidify)
setwd("~/Dropbox/Lancaster/")
author("PackageDevelopment")
## Edit the file index.Rmd file and then
slidify("index.Rmd")
sessionInfo()
## R version 3.0.1 (2013-05-16)
## Platform: x86_64-apple-darwin10.8.0 (64-bit)
##
## locale:
## [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] slidify_0.3.3
##
## loaded via a namespace (and not attached):
## [1] digest_0.6.3 evaluate_0.4.3 formatR_0.7 knitr_1.2
## [5] markdown_0.5.4 stringr_0.6.2 tools_3.0.1 whisker_0.3-2
## [9] yaml_2.1.7