`invisible(...)` did not throw the expected warning.

#invisible(capture.output()) is used throughout to prevent the increment
#Create a vector of time that represent times where data are sampled.
#Form a signal (time series) that contains two frequencies:
#Making the single side amp spectrum manually
P1[c((2:(length(P1)-1)))] <- 2*P1[c((2:(length(P1)-1)))]  #Double amplitude because we are only looking at one side.
#Use math operations to see if one sided amplitude
S1 <- S1 + rnorm(length(t)) #Add some noise
S2 <- S2 + rnorm(length(t)) #Add some noise
S3 <- S3 + rnorm(length(t)) #Add some noise
list.of.windows <- list(S1.data.frame, S2.data.frame, S3.data.frame)
invisible(capture.output(averaged_results <- MakeCompositePSDForAllWindows(list.of.windows, "Signal", Fs, 0, 50, 0.1)))
expected_average <- (PSD1 + PSD2 + PSD3)/3
invisible(capture.output(averaged_results <- MakeCompositeXYPlotForAllWindows(list.of.windows, "Signal", 0, 999, 1)))
combined_timeseries <- rbind(S1, S2, S3)
S1.data.frame <- as.data.frame(cbind(t, S1, level1.vals, level2.vals))
colnames(S1.data.frame) <- c("Time", "Signal", "level1.ID", "level2.ID")
S2.data.frame <- as.data.frame(cbind(t, S2, level1.vals, level2.vals))
colnames(S2.data.frame) <- c("Time", "Signal", "level1.ID", "level2.ID")
S3.data.frame <- as.data.frame(cbind(t, S3, level1.vals, level2.vals))
colnames(S3.data.frame) <- c("Time", "Signal", "level1.ID", "level2.ID")
S4.data.frame <- as.data.frame(cbind(t, S4, level1.vals, level2.vals))
colnames(S4.data.frame) <- c("Time", "Signal", "level1.ID", "level2.ID")
windows <- list(S1.data.frame, S2.data.frame, S3.data.frame, S4.data.frame)
#Gets the composite of the first, second, and third signal. Should result in a flat signal.
FirstComboToUse <- list( c("a"), c(1, 2, 3) )
#Gets the composite of the third and fourth signal
SecondComboToUse <- list( c("a", "b"), c(3) )
timeseries.results <- AutomatedCompositePlotting(list.of.windows = windows,
level.combinations.labels = c("Signal 1 + 2 + 3", "Signal 3 + 4"),
#Is the first object a list of dataframes, with the length of list equal the number of combinations.
#Does the ggplot have two layers, one for each combo.
timeseries.results.envelope <- AutomatedCompositePlotting(list.of.windows = windows,
#Does the ggplot have two layers, one for each combo, and one for envelope
#Expect warning about tied ranks from the statistical testing
PSD.results <- AutomatedCompositePlotting(list.of.windows = windows,
#Does the ggplot have two layers, one for each combo, and one for envelope.
#Is the third object a list with three objects for statistical testing.
#Is the first object for statistical testing a dataframe with number of rows = number of total windows to make composites.
number_of_windows_used <- length(FirstComboToUse[[1]]) * length(FirstComboToUse[[2]]) + length(SecondComboToUse[[1]]) * length(SecondComboToUse[[2]])
#Is the second object for statistical testing using kruskal wallis chi-squared.
#Is the third object for statistical testing using wilcoxon rank sum test.
PSD.results.envelope <- AutomatedCompositePlotting(list.of.windows = windows,
LogPSD.results <- AutomatedCompositePlotting(list.of.windows = windows,
LogPSD.results.envelope <- AutomatedCompositePlotting(list.of.windows = windows,
integration.results <- PSDIntegrationPerFreqBin(Fs, S, bins)
expect_equal(integration.results[[1]][[2]] + integration.results[[2]][[2]], integration.results[[3]][[2]], tolerance = 0.01)
expect_equal(integration.results[[4]][[2]], 0, tolerance = 0.01)
results <- PSDIdentifyDominantFrequency(Fs, S1.data.frame[,"Signal"], 0, 10, 0.01)
test_that("SingleBinPSDIntegrationOrDominantFreqComparison integration comparison works", {
S5.data.frame <- as.data.frame(cbind(t, S5, level1.vals, level2.vals))
colnames(S5.data.frame) <- c("Time", "Signal", "level1.ID", "level2.ID")
#Extra representation of S2 dataframe to show an example that has enough samples
#to have significance for Kruskal-Wallis test
windows <- list(S1.data.frame, S2.data.frame, S2.data.frame, S2.data.frame, S2.data.frame,
S2.data.frame, S2.data.frame, S2.data.frame, S2.data.frame, S2.data.frame, S3.data.frame,
S5.data.frame, S5.data.frame, S5.data.frame, S5.data.frame, S5.data.frame)
# Test integration to see if non-significant difference is indicated as non-sig
#Are there 13 windows in total. "Signal 1 + 2 + 3" should have 11. "Signal 3 + 4" should have 2.
#Note that a single window can be found in multiple categories.
# Test integration to see if significant difference is indicated as sig
level.combinations.labels = c("Signal 1 + 2 + 3", "Signal 5"),
#Are there 16 windows in total. "Signal 1 + 2 + 3" should have 11. "Signal 5" should have 5.
test_that("SingleBinPSDIntegrationOrDominantFreqComparison dominant frequency comparison works", {
# Test dominant frequency to see if non-significant difference is indicated as non-sig
#Does p-value indicate non-significant (NA since all values are the same)
# Test dominant frequency to see if significant difference is indicated as sig