knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

rsatz

rsatz is a minimal library to simply make fake time series data in a tidy way

Installation

You can install the released version of rsatz from CRAN with:

install.packages("rsatz")

Example

This is a basic example which shows you how to make a very simple data set:

library(rsatz)
library(tidyverse)

generate_signal(7, amplitude = 5) %>% 
  shift_signal(10) %>% 
  add_noise() %>% 
  ggplot(aes(date_time, signal)) +
  geom_line()

Or something more complicated.

generate_signal(7 * 4 * 12, amplitude = 5) %>% 
  shift_signal(centre_point = 10) %>% 
  make_trend(start = 7 * 4 * 48, strength = 5) %>%
  make_trend(start = 7 * 4 * 48 * 2, strength = -10) %>%
  make_weekends() %>%  
  make_anomalies(n = 0.2) %>% 
  add_seasonality() %>% 
  add_noise(low = 1, high = 5) %>% 
  ggplot(aes(date_time, signal)) +
  geom_line()


surple-energy/rsatz documentation built on Feb. 29, 2020, 12:49 a.m.