library(dplyr, warn.conflicts = FALSE)
data(chaingang)
chaingang <- mutate(chaingang,
Wbal = Wbalance(time.s, power.W, CP = 325))
# For an estimate of W'
max(chaingang$Wbal)
# This is probably being inflated by passing raw power data
# to the function. A solution:
chaingang <- mutate(chaingang,
power.W = roll_mean(power.W, 25, ema = TRUE),
Wbal = Wbalance(time.s, power.W, CP = 325))
max(chaingang$Wbal) # 19.4 is more realistic.
plot(Wbal ~ time.s, type = "l", col = "red", data = chaingang)
# This representation is probably unintuitive to most.
# Hence, some modified approaches:
# Reverse the y axis...
ylim <- extendrange(chaingang$Wbal) %>% rev
plot(Wbal ~ time.s, type = "l", col = "red", ylim = ylim, data = chaingang)
title("Flipped y axis")
# Subtract an estimate of W'
Wprime <- max(chaingang$Wbal)
plot(Wprime - Wbal ~ time.s, type = "l", col = "red", data = chaingang)
title("W' subtracted")
Run the code above in your browser using DataLab