rescale_peaks {forceR} | R Documentation |
Rescale Peaks
Description
Rescales time series in x and y to values ranging from 0 to 1.
Usage
rescale_peaks(
df.peaks,
df.data,
plot.to.screen = FALSE,
path.data = NULL,
show.progress = FALSE
)
Arguments
df.peaks |
The resulting tibble of the function |
df.data |
A data frame or tibble in the below format. The columns |
plot.to.screen |
A logical value indicating if results should be
plotted in the current R plot device. Default: |
path.data |
A string character defining where to save the results.
If |
show.progress |
A logical value indicating if progress should be
printed to the console. Default: |
Details
df.peaks
at least needs to contain the following columns:
species | measurements | starts | ends |
species.1 | measurements.1 | starts.1 | ends.1 |
... | ... | ... | ... |
species.n | measurements.n | starts.m | ends.m |
Check forceR::peaks.df
to see an example tibble.
df.data
at least needs to contain the following columns:
t | force | measurement |
t.1 | force.1 | measurement.1 |
... | ... | ... |
t.n | force.n | measurement.m |
Check forceR::df.all.200.tax
to see an example tibble.
Value
This function returns a tibble in the same format as df
, but with
the additional columns t.norm
and force.norm
which will contain the
rescaled time and force data both ranging from 0 to 1.
Examples
# Using the forceR::df.all.200.tax and forceR::df.all.200.tax datasets:
# rescale bites
peaks.df.norm <- rescale_peaks(df.peaks = forceR::peaks.df,
df.data = forceR::df.all.200.tax,
plot.to.screen = FALSE,
path.data = NULL,
show.progress = FALSE)
# maximum values of time and force both range from 0 - 1:
range(peaks.df.norm$t.norm)
range(peaks.df.norm$force.norm)