An open API service indexing awesome lists of open source software.

https://github.com/lightbridge-ks/simwaves

R 📦 for Simulate Waveform data
https://github.com/lightbridge-ks/simwaves

data-simulation r-package sinusoidal-wave

Last synced: about 2 months ago
JSON representation

R 📦 for Simulate Waveform data

Awesome Lists containing this project

README

          

---
output: github_document
---

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

# simWaves

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)

**An R-package for Simulating Waveform to a Data Frame**

## Installation

You can install the development version of simWaves from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("Lightbridge-KS/simWaves")
```

## Simulate Trigonometric Waves

```{r load-simWaves}
library(simWaves)
```

### Basic Sinusoid Waves

`sim_sinusoid` will simulate any waves from a given function (e.g. trigonometric functions).

Let's start with 1 sine wave.

```{r sim_sin_1}
# Simulate to a data frame
df1 <- sim_sinusoid("sin", n = 1)
# Plot
plot(df1, type = "l")
```
Now, I'll change simulating function to `cos` with wavelength 2 and amplitude 3.

```{r sim_sin_2}
df2 <- sim_sinusoid("cos", lambda = 2, amp = 3)
plot(df2, type = "l")
```

### Sinusoid Waves + Linear Models

You can use `sim_sinusoid_lm()` to simulate sinusoidal wave, also, add linear model ontop.

Let's create 10 sine waves plus linear model with slope 1 and some random error.

```{r sim_sinusoid_lm_1}
df3 <- sim_sinusoid_lm("sin", n = 10, slope = 1, epsilon_sd = 0.1, by = 0.01)
plot(df3, type = "l")
```