sim_data: Randomly generate data for internal testing of 'auto_rate()"s...

Description Usage Arguments Details Value See Also Examples

View source: R/sim_data.R

Description

Generate data of size len that is coerced to mimic common respirometry data. This is an internal function not meant for public use. We will modify this function at any time, which may irreversibly change the outputs. Do NOT use this for work! This function was first created to test auto_rate() using the other internal function, test_lin(), but we decided to publish the code as it is an effective (and visually-appealing) tool for teaching purposes. This function is by no means comprehensive and we encourage users to generate data that suit their own unique situations.

Usage

1
sim_data(len = 300, type = "default", sd = 0.05, preview = TRUE)

Arguments

len

numeric. Defaults at 300. Number of observations in the dataset.

type

character. What kind of data should the function generate? Available for use: "default", "corrupted" and "segmented".

sd

numeric. Defaults at 0.05. This is the amount of noise to add to the system, randomly generated as a standard deviation based on the entire data set.

preview

logical. Defaults to TRUE. Plots the generated data as an xy.

Details

sim_data() creates 3 types of data that we think are common in respirometry or oxygen flux data. The data types can be selected using the method argument:

Normally-distributed noise is added to the dataset to add variation, which can be modified using the "sd" argument.

Value

A list containing the dataframe, the slope and the length of the linear section of the data, to be used for analysis in the function test_lin().

See Also

test_lin()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Generate data of length 200
sim_data(len = 200)

# Generate data that contains a "corruption"
sim_data(type = "corrupted")

# Generate noisy data
sim_data(type = "segmented", sd = .2)

# Generate "perfect" non-noisy data
sim_data(sd = 0)

januarharianto/respR documentation built on Nov. 13, 2018, 1:21 p.m.