Description Usage Arguments Value Examples
View source: R/utility_functions.R
returns windows aroung increasing series by group indices
1 | extractWindowAroundIndices(df, windowLength, startIndices, groupingVariable)
|
df |
Input dataframe, should contain a grouping column called groupingVariable |
startIndices |
Should contain the indices as start from the grouped series |
groupingVariable |
The name of the column that will be used for the inned join |
windowLenght |
Must be an odd number |
A new data frame containing just the matching columns
1 2 3 4 5 6 | A <- data.frame(name = "A", valNumeric = c(1:9), valCategorical = c("YES","NO","MAYBE"))
B <- data.frame(name = "B", valNumeric = c(5:100), valCategorical = c('YES','NO'))
C <- data.frame(name = "C", valNumeric = c(5:7), valCategorical = c('green','green','blue'))
df <- rbind(A,B,C)
startIndices <- data.frame(name = c("A","B","C"), index = c(3,10,2))
ggplot(extractWindowAroundIndices(df, 5, startIndices, "name"), aes(position, valNumeric, color = name)) + geom_line()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.