apply_model_func: Apply a model-like function to dataset

View source: R/apply_model_func.R

apply_model_funcR Documentation

Apply a model-like function to dataset

Description

This function applies a model to a nested dataframe and return a new column with the model object. It accets function models expressions in the form of: my_model <- funcion(my_dataset){ lm(value ~ condition_1 + condition_2, data = my_dataset) }, where value, is the name of your variable of interest and condition_1 + condition_2 are the explanatory variables. It can also use other type of model expression.

Usage

apply_model_func(dataset, targed_dataset = "data", my_model)

Arguments

dataset

A nested dataframe. Ideally, previously grouped by the paramters of interes to be analyzed. Eg. wave frequency, wave latency, amplitude, etc.

targed_dataset

Character. the column name of the dataset to perform the summary. By default uses the colum named "data" containing the raw dataset, but if you have transformed data e.ge logarithmic, centered, etc., you can input the name of such column.

my_model

A function. A function containing the model to apply to your targeted dataset.

Value

The input dataframe with a new column named "my_model" containing the model object.

Examples

# the example is missing

rjlopez2/AnlysisOfWaves documentation built on Sept. 15, 2022, 2:25 p.m.