knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

ForcePlate

The goal of the ForcePlate package is to extract and process features to characterize of a recorded stabilogram.

Installation

You can install the development version of ForcePlate from GitHub with:

# install.packages("devtools")
devtools::install_github("joergheintz/ForcePlate")

Example: Derivatives of center point of force displacement

This is a basic example which shows you how to calculate a speed and acceleration. $$ \begin{aligned} \dot{x_t} &= \frac{x_{t+1} - x_{t-1}}{2 \Delta t} \ \ddot{x_t} &= \frac{x_{t+1} - 2 x_t + x_{t-1}}{2 \Delta t} \ \end{aligned} $$

library(ForcePlate)
library(ggplot2)
library(kableExtra)
library(tibble)


## basic example code
      time = seq(0.01,6.28, 0.01)
      distance = sin(time)
      df = derivatives(y = distance, t = time)

## output
      as_tibble(rbind(head(df, 3), tail(df, 3)))

The function "derivatives" takes time and response as vectors and returns data frame. The chosen algorithm requires 3 data points to estimate velocity and acceleration the data set is therefore reduced n - 2 records. The data frame output shows head and tail for the data set with the NA.

# remove NA
      df = df[complete.cases(df), ]

# output
      ggplot(data = df) +  
      geom_point(aes(x = t, y = y ), color = 'blue', size = 1) + 
      geom_point(aes(x = t, y = y.), color = 'darkgreen', alpha = 1)  + 
      geom_point(aes(x = t, y = y.. ), color = 'darkorange', alpha = 0.5, shape = 21) +
            ylab(paste("y, y., y..")) + 
            xlab("time")


joergheintz/ForcePlate documentation built on June 26, 2022, 4:39 p.m.