├── vignettes ├── .gitignore └── test.Rmd ├── data └── WWW2.RData ├── NAMESPACE ├── R ├── data-WWW2.R ├── hello.R └── littleforecast.R ├── .gitignore ├── .Rbuildignore ├── man ├── WWW2.Rd ├── littleforecast.Rd └── hello.Rd └── DESCRIPTION /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /data/WWW2.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/ToyDataPackage/main/data/WWW2.RData -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(hello) 4 | export(littleforecast) 5 | -------------------------------------------------------------------------------- /R/data-WWW2.R: -------------------------------------------------------------------------------- 1 | #' @title WWW2 2 | #' 3 | #' @description WWW data squared. 4 | #' 5 | #' \itemize{ 6 | #' \item You could add more details 7 | #' \item with a list if you had columns 8 | #' } 9 | #' 10 | #' @docType data 11 | #' @name WWW2 12 | #' @usage data(WWW2) 13 | #' @format A ts object. 14 | NULL 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | inst/doc 6 | *.Rproj 7 | MyNewPackage.Rcheck/ 8 | MyNewPackage*.tar.gz 9 | MyNewPackage*.tgz 10 | MyDataPackage.Rcheck/ 11 | MyDataPackage*.tar.gz 12 | MyDataPackage*.tgz 13 | ToyDataPackage.Rcheck/ 14 | ToyDataPackage*.tar.gz 15 | ToyDataPackage*.tgz 16 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^_pkgdown\.yml$ 4 | ^docs$ 5 | ^pkgdown$ 6 | ^\.github$ 7 | ^MyNewPackage\.Rcheck$ 8 | ^MyNewPackage.*\.tar\.gz$ 9 | ^MyNewPackage.*\.tgz$ 10 | ^MyDataPackage\.Rcheck$ 11 | ^MyDataPackage.*\.tar\.gz$ 12 | ^MyDataPackage.*\.tgz$ 13 | ^ToyDataPackage\.Rcheck$ 14 | ^ToyDataPackage.*\.tar\.gz$ 15 | ^ToyDataPackage.*\.tgz$ 16 | -------------------------------------------------------------------------------- /R/hello.R: -------------------------------------------------------------------------------- 1 | #' @title Hello 2 | #' 3 | #' @description This is the new function. The other function is [littleforecast()]. 4 | #' \code{\link{littleforecast}()}. 5 | #' 6 | #' Another paragraph. 7 | #' 8 | #' @param mytext text to print 9 | #' 10 | #' 11 | #' @export 12 | hello <- function(mytext="") { 13 | cat(paste("Hello, world!", mytext, collapse="\n")) 14 | } 15 | -------------------------------------------------------------------------------- /man/WWW2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-WWW2.R 3 | \docType{data} 4 | \name{WWW2} 5 | \alias{WWW2} 6 | \title{WWW2} 7 | \format{ 8 | A ts object. 9 | } 10 | \usage{ 11 | data(WWW2) 12 | } 13 | \description{ 14 | WWW data squared. 15 | 16 | \itemize{ 17 | \item You could add more details 18 | \item with a list if you had columns 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /man/littleforecast.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/littleforecast.R 3 | \name{littleforecast} 4 | \alias{littleforecast} 5 | \title{Little Forecast} 6 | \usage{ 7 | littleforecast(data, nyears = 10, col = c("red", "blue", "green")) 8 | } 9 | \description{ 10 | This does an arima forecast 11 | } 12 | \examples{ 13 | library(stats) 14 | lm(a ~ b, data=df) 15 | } 16 | -------------------------------------------------------------------------------- /man/hello.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/hello.R 3 | \name{hello} 4 | \alias{hello} 5 | \title{Hello} 6 | \usage{ 7 | hello(mytext = "") 8 | } 9 | \arguments{ 10 | \item{mytext}{text to print} 11 | } 12 | \description{ 13 | This is the new function. The other function is \code{\link[=littleforecast]{littleforecast()}}. 14 | \code{\link{littleforecast}()}. 15 | 16 | Another paragraph. 17 | } 18 | -------------------------------------------------------------------------------- /R/littleforecast.R: -------------------------------------------------------------------------------- 1 | #' @title Little Forecast 2 | #' 3 | #' @description This does an arima forecast 4 | #' 5 | #' @examples 6 | #' library(stats) 7 | #' lm(a ~ b, data=df) 8 | #' @export 9 | littleforecast <- function(data, nyears=10, col=c("red", "blue", "green")){ 10 | # tests 11 | col <- match.arg(col) 12 | 13 | fit <- forecast::auto.arima(data) 14 | fc <- forecast::forecast(fit, h = nyears) 15 | ggplot2::autoplot(fc, fcol=col) 16 | } 17 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: ToyDataPackage 2 | Type: Package 3 | Title: A package with data. 4 | Version: 0.1.0 5 | Author: Who wrote it 6 | Maintainer: The package maintainer 7 | Description: This package shows you where to add data and how to document it. 8 | License: GPL-2 9 | Encoding: UTF-8 10 | Imports: forecast, ggplot2 11 | Suggests: knitr, rmarkdown, stats 12 | VignetteBuilder: knitr 13 | LazyData: true 14 | RoxygenNote: 7.1.2 15 | Roxygen: list(markdown = TRUE) 16 | -------------------------------------------------------------------------------- /vignettes/test.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "testVignette" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{testVignette} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | # Introduction 11 | 12 | This report uses data version `r packageVersion("ToyDataPackage")`. We can automatically get the data package version using `packageVersion("ToyDataPackage")`. 13 | 14 | ```{r setup, include=FALSE} 15 | library(ToyDataPackage) 16 | ``` 17 | 18 | ```{r fig.cap=paste("This figure uses ToyDataPackage version", packageVersion("ToyDataPackage"))} 19 | plot(WWW2) 20 | ``` 21 | 22 | ```{r fig.cap=paste("This figure uses ToyDataPackage version", packageVersion("ToyDataPackage")), message=FALSE} 23 | littleforecast(WWW2) 24 | ``` --------------------------------------------------------------------------------