-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
building vignette, build tests for qstack
- Loading branch information
1 parent
03ea5d8
commit b756888
Showing
14 changed files
with
599 additions
and
72 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
Meta |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## ---- include = FALSE--------------------------------------------------------- | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>" | ||
) | ||
|
||
## ----setup-------------------------------------------------------------------- | ||
library(timeseries) | ||
library(gapminder) | ||
library(dplyr) | ||
|
||
## ----dataset------------------------------------------------------------------ | ||
testdf <- data.frame(year = rep(seq(from = 1980, to= 1990, 1), 3), | ||
rainfall = c(runif(11, 0, 100), rnorm(11, 70, 10), | ||
rnorm(11, 20, 20)), | ||
temp = c(rnorm(11, 70, 30), rnorm(11, 45, 20), | ||
rnorm(11, 100, 10)), | ||
daysofsun = c(NA, NA, rnorm(9, 280, 50), rnorm(11, 300, 30), NA, | ||
rnorm(10, 340, 15)), | ||
region = c(rep("A",11), rep("B", 11), rep("C", 11))) | ||
|
||
## ----example 1---------------------------------------------------------------- | ||
qstacktseries(testdf, year, rainfall, region, verbose = TRUE) | ||
|
||
## ----example 2---------------------------------------------------------------- | ||
qstacktseries(gapminder %>% | ||
filter(continent == "Asia"), year, gdpPercap, country, verbose = TRUE) | ||
|
||
## ----example 3: Errors, error=TRUE-------------------------------------------- | ||
|
||
qstacktseries(gapminder %>% | ||
filter(continent == "Asia"),continent, pop, country, verbose = TRUE) | ||
|
||
qstacktseries(gapminder %>% | ||
filter(continent == "Africa"), year, country, continent, verbose = TRUE) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
title: "qstacktseries" | ||
output: rmarkdown::html_vignette | ||
vignette: > | ||
%\VignetteIndexEntry{qstacktseries} | ||
%\VignetteEngine{knitr::rmarkdown} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
|
||
```{r, include = FALSE} | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>" | ||
) | ||
``` | ||
|
||
```{r setup} | ||
library(timeseries) | ||
library(gapminder) | ||
library(dplyr) | ||
``` | ||
|
||
This is how the function `qstacktseries` works: | ||
|
||
Building a stacked area time series plot with a dummy data set: | ||
|
||
```{r dataset} | ||
testdf <- data.frame(year = rep(seq(from = 1980, to= 1990, 1), 3), | ||
rainfall = c(runif(11, 0, 100), rnorm(11, 70, 10), | ||
rnorm(11, 20, 20)), | ||
temp = c(rnorm(11, 70, 30), rnorm(11, 45, 20), | ||
rnorm(11, 100, 10)), | ||
daysofsun = c(NA, NA, rnorm(9, 280, 50), rnorm(11, 300, 30), NA, | ||
rnorm(10, 340, 15)), | ||
region = c(rep("A",11), rep("B", 11), rep("C", 11))) | ||
``` | ||
|
||
```{r example 1} | ||
qstacktseries(testdf, year, rainfall, region, verbose = TRUE) | ||
``` | ||
Building a stacked area time series plot with a pre-existing data set: *gapminder* | ||
|
||
```{r example 2} | ||
qstacktseries(gapminder %>% | ||
filter(continent == "Asia"), year, gdpPercap, country, verbose = TRUE) | ||
``` | ||
These are some errors you might see if `qstacktseries` is given non-numeric input for the *time* or *voi* inputs: | ||
|
||
```{r example 3: Errors, error=TRUE} | ||
qstacktseries(gapminder %>% | ||
filter(continent == "Asia"),continent, pop, country, verbose = TRUE) | ||
qstacktseries(gapminder %>% | ||
filter(continent == "Africa"), year, country, continent, verbose = TRUE) | ||
``` | ||
|
Oops, something went wrong.