sim_data {respR}R Documentation

Randomly generate data for internal testing of auto_rate()'s linear method.

Description

Generate data of size len that is coerced to mimic common respirometry data. This is an internal function not intending for public use, though may prove of interest or utility. We may modify this function at any time, which may irreversibly change the outputs. 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, testing and visualising purposes. This function is by no means comprehensive and we encourage users to generate data that suit their own unique situations.

Usage

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 type input:

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

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

# 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)

[Package respR version 2.3.3 Index]