knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(timeseries)

This is how the function qtseries works:

Building a time series plot with a dummy data set

testdf <- data.frame(year = rep(seq(from = 1980, to= 1990, 1), 3),
                       rainfall = c(rnorm(11, 100, 30), rnorm(11, 70, 10),rnorm(11, 20, 20)),
                       temp = c(rnorm(11, 70, 30), rnorm(11, 100, 10),rnorm(11, 45, 20)),
                       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)))
qtseries(testdf, year, daysofsun, region, verbose = TRUE)

Building a time series plot with the gapminder data set:

library(gapminder)
library(magrittr)
library(dplyr)
gapminder %>%
  filter(continent == "Europe")%>%
  qtseries(year, pop, country, verbose = TRUE)

Some errors you might see if qtseries is given non-numeric variables for the time or voi inputs:

gapminder %>%
  filter(continent == "Europe")%>%
  qtseries(continent, pop, country, verbose = TRUE)

gapminder %>%
  filter(continent == "Europe")%>%
  qtseries(year, country, continent, verbose = TRUE)


nicolalove/timeseries documentation built on Dec. 31, 2020, 12:05 a.m.