GetSubsetOfWindows.Rd
Looks at all the windows (dataframes) in a list of homogeneous windows. And only selects the windows where the column value contains a specified value.
GetSubsetOfWindows( list.of.windows, name.of.column.to.look.at.in.window, value.to.match.to )
list.of.windows | A list of windows (dataframes) and each window can only have a single unique value for the name.of.column.to.look.at.in.window column. |
---|---|
name.of.column.to.look.at.in.window | String that specifies which column to look at. |
value.to.match.to | String that specifies what value to look for in name.of.column.to.look.at.in.window. |
List containing only selected windows (windows that have value.to.match.to value in the name.of.column.to.look.at.in.window column).
Takes a List of windows (dataframes) where each window is a homogeneous window, which means in each window, there is only one unique value in the specified column. This function looks through the homogeneous windows in the List, selects the windows that have a specified column value in the specified column, then puts these windows into a new List and outputs the new List of windows.
#Example using a dataframe with 3 windows. #Windows 20 and 30 are homogeneous if looking at col.two and col.three values. window.name.column <- c(10, 10, 10, 20, 20, 20, 30, 30, 30, 30) col.two <- c("a", "a", "a", "a", "a", "a", "a", "a", "a", "a") col.three <- c(1, 1, 0, 1, 1, 1, 2, 2, 2, 2) multi.window.data <- data.frame(window.name.column, col.two, col.three) list.of.homogeneous.windows <- GetHomogeneousWindows(multi.window.data, "window.name.column", c("col.two", "col.three")) #Get a subset of windows where col.three has a value of 2 subset.list.of.homogeneous.windows <- GetSubsetOfWindows(list.of.homogeneous.windows, "col.three", "2") str(subset.list.of.homogeneous.windows)#> List of 1 #> $ :'data.frame': 4 obs. of 3 variables: #> ..$ window.name.column: num [1:4] 30 30 30 30 #> ..$ col.two : chr [1:4] "a" "a" "a" "a" #> ..$ col.three : num [1:4] 2 2 2 2subset.list.of.homogeneous.windows[[1]]#> window.name.column col.two col.three #> 7 30 a 2 #> 8 30 a 2 #> 9 30 a 2 #> 10 30 a 2