y_to_force {forceR} | R Documentation |
Convert Time Series to Force
Description
Converts a time series, e.g. a continuous voltage measurement from a sensor to force data according to an amplification value and, depending on the measurement setup, the lever ratio of the rocker forwarding the force from the point the force acts on to the sensor.
Usage
y_to_force(df, classifier, measurement.col)
Arguments
df |
Data frame or tibble in the below mentioned format. This should contain the time series, with one line per time step and measurement. |
classifier |
Classifier in the below mentioned format. |
measurement.col |
Character string. If |
Details
These values should be stored in a classifier
(s. below). At the same, it adds specimen
and species
info from the respective columns of the classifier
.
The classifier
should have the following format:
species | specimen | measurement | amp | lever.ratio |
species.1 | specimen.1 | measurement.1 | amp.1 | lever.ratio.1 |
... | ... | ... | ... | ... |
species.n | specimen.n | measurement.n | amp.n | lever.ratio.n |
It must contain one row per unique measurement number that is present in the df.
The force (F
) in Newton is calculated via the following formula:
F = y * lever.ratio * (1 / amp)
where y
is the measurement series, e.g. in V
,
amp
is the amplification value, e.g. in V/N
,
and lever.ratio
is the mechanical lever ratio of the measurement setup.
df
should have the following format:
t | y | measurement |
t.1 | y.1 | measurement.1 |
t.2 | y.2 | measurement.1 |
... | ... | ... |
t.n | y.n | measurement.1 |
t.1 | y.1 | measurement.2 |
t.2 | y.2 | measurement.2 |
... | ... | ... |
t.m | y.m | measurement.2 |
... | ... | ... |
t.o | y.o | measurement.o |
Value
Returns a tibble in the same format as the input tibble with an additional column called '"'force
'.
Examples
# convert y column of df.all to force column and add taxonomic data
# using info from classifier
df.all.tax <- y_to_force(df = forceR::df.all.200,
classifier = forceR::classifier,
measurement.col = "measurement")
df.all.tax