Skip to contents

Extract a single phase from segmented data

Usage

extractPhase(x, phase_name, search_subphases = TRUE)

Arguments

x

A segmented_phases object

phase_name

Name of the phase to extract

search_subphases

Whether to search within subphases

Value

A matrix of phase data

References

Winter DA (2009). "Biomechanics and Motor Control of Human Movement." 4th ed. Wiley.

Examples

set.seed(123)
data <- matrix(rnorm(200), 100, 2)
events <- data.frame(
  event = c("hs1","ff","ms","ho","to","hs2"),
  label = c("Heel Strike","Foot Flat","Midstance","Heel Off","Toe Off","Heel Strike 2"),
  index = c(1, 13, 31, 41, 61, 100), time = c(0, .12, .30, .40, .60, 1.0),
  percent = c(0, 12, 30, 40, 60, 100), method = rep("manual", 6),
  confidence = rep(1, 6), stringsAsFactors = FALSE)
class(events) <- c("detected_events", "data.frame")
attr(events, "sampling_rate") <- 100
phases <- segmentPhases(data, events, schema_gait)
extractPhase(phases, getPhaseNames(schema_gait)[1])
#>              [,1]        [,2]
#>  [1,] -0.56047565 -0.71040656
#>  [2,] -0.23017749  0.25688371
#>  [3,]  1.55870831 -0.24669188
#>  [4,]  0.07050839 -0.34754260
#>  [5,]  0.12928774 -0.95161857
#>  [6,]  1.71506499 -0.04502772
#>  [7,]  0.46091621 -0.78490447
#>  [8,] -1.26506123 -1.66794194
#>  [9,] -0.68685285 -0.38022652
#> [10,] -0.44566197  0.91899661
#> [11,]  1.22408180 -0.57534696
#> [12,]  0.35981383  0.60796432
#> [13,]  0.40077145 -1.61788271
#> [14,]  0.11068272 -0.05556197
#> [15,] -0.55584113  0.51940720
#> [16,]  1.78691314  0.30115336
#> [17,]  0.49785048  0.10567619
#> [18,] -1.96661716 -0.64070601
#> [19,]  0.70135590 -0.84970435
#> [20,] -0.47279141 -1.02412879
#> [21,] -1.06782371  0.11764660
#> [22,] -0.21797491 -0.94747461
#> [23,] -1.02600445 -0.49055744
#> [24,] -0.72889123 -0.25609219
#> [25,] -0.62503927  1.84386201
#> [26,] -1.68669331 -0.65194990
#> [27,]  0.83778704  0.23538657
#> [28,]  0.15337312  0.07796085
#> [29,] -1.13813694 -0.96185663
#> [30,]  1.25381492 -0.07130809
#> [31,]  0.42646422  1.44455086
#> [32,] -0.29507148  0.45150405
#> [33,]  0.89512566  0.04123292
#> [34,]  0.87813349 -0.42249683
#> [35,]  0.82158108 -2.05324722
#> [36,]  0.68864025  1.13133721
#> [37,]  0.55391765 -1.46064007
#> [38,] -0.06191171  0.73994751
#> [39,] -0.30596266  1.90910357
#> [40,] -0.38047100 -1.44389316
#> [41,] -0.69470698  0.70178434
#> [42,] -0.20791728 -0.26219749
#> [43,] -1.26539635 -1.57214416
#> [44,]  2.16895597 -1.51466765
#> [45,]  1.20796200 -1.60153617
#> [46,] -1.12310858 -0.53090652
#> [47,] -0.40288484 -1.46175558
#> [48,] -0.46665535  0.68791677
#> [49,]  0.77996512  2.10010894
#> [50,] -0.08336907 -1.28703048
#> [51,]  0.25331851  0.78773885
#> [52,] -0.02854676  0.76904224
#> [53,] -0.04287046  0.33220258
#> [54,]  1.36860228 -1.00837661
#> [55,] -0.22577099 -0.11945261
#> [56,]  1.51647060 -0.28039534
#> [57,] -1.54875280  0.56298953
#> [58,]  0.58461375 -0.37243876
#> [59,]  0.12385424  0.97697339
#> [60,]  0.21594157 -0.37458086
#> [61,]  0.37963948  1.05271147