avg_peaks {forceR}R Documentation

Average Curves per Group

Description

Calculates mean curve shape per group (here: species) and rescales result on the y axis to range from 0 to 1.

Usage

avg_peaks(df, path.data = NULL)

Arguments

df

The resulting tibble of the function red_peaks_100(). See ?red_peaks_100 for more details.

path.data

A string character defining where to save the results. If NULL, data will not be saved to disk. Default: NULL.

Value

This function returns a tibble made of three columns: species containing the species names, index ranging from 1 to 100 for each species, and force.norm.100 containing the averaged and rescaled curve of each species.

Examples

# Using the forceR::df.all.200.tax dataset:

# calculate mean curves per species
peaks.df.100.avg <- avg_peaks(df = forceR::peaks.df.norm.100,
                               path.data = NULL)

# plot averaged normalized curves per species
require(ggplot2)
ggplot(peaks.df.100.avg,
          aes(x = index ,
               y = force.norm.100.avg,
               colour=species)) +
  geom_line()


[Package forceR version 1.0.20 Index]