Nothing
source("libtest.R")
test_that("mc_filter prep format", {
data <- mc_read_data("../data/TOMST/files_table2.csv", clean=FALSE)
filtered <- mc_filter(data)
test_raw_data_format(filtered)
expect_equal(length(filtered$localities), 3)
filtered <- mc_filter(data, c("A2E32", "A1E05"))
test_raw_data_format(filtered)
expect_equal(names(filtered$localities), c("A1E05", "A2E32"))
expect_equal(length(filtered$localities$A1E05$loggers), 2)
expect_equal(length(filtered$localities$A1E05$loggers[[1]]$sensors), 1)
expect_equal(length(filtered$localities$A1E05$loggers[[2]]$sensors), 4)
expect_equal(length(filtered$localities$A2E32$loggers[[1]]$sensors), 4)
filtered <- mc_filter(data, sensors=c("TMS_T1", "TMS_T2"))
test_raw_data_format(filtered)
expect_equal(names(filtered$localities), c("A1E05", "A2E32"))
expect_equal(length(filtered$localities$A1E05$loggers), 1)
expect_equal(length(filtered$localities$A1E05$loggers[[1]]$sensors), 2)
expect_equal(length(filtered$localities$A2E32$loggers[[1]]$sensors), 2)
filtered <- mc_filter(data, c("A6W79", "A2E32", "A1E05"), "TMS_T2")
test_raw_data_format(filtered)
expect_equal(names(filtered$localities), c("A1E05", "A2E32"))
expect_equal(length(filtered$localities$A1E05$loggers), 1)
expect_equal(length(filtered$localities$A1E05$loggers[[1]]$sensors), 1)
expect_equal(length(filtered$localities$A2E32$loggers[[1]]$sensors), 1)
filtered <- mc_filter(data, "A2E32", "TMS_T3")
expect_equal(names(filtered$localities), "A2E32")
expect_equal(names(filtered$localities$A2E32$loggers[[1]]$sensors), "TMS_T3")
})
test_that("mc_filter reverse prep format", {
data <- mc_read_data("../data/TOMST/files_table2.csv", clean=FALSE)
expect_error(filtered <- mc_filter(data, reverse = TRUE))
filtered <- mc_filter(data, c("A2E32", "A1E05"), reverse=TRUE)
test_raw_data_format(filtered)
expect_equal(names(filtered$localities), "A6W79")
expect_equal(length(filtered$localities$A6W79$loggers[[1]]$sensors), 4)
filtered <- mc_filter(data, sensors=c("TMS_T1", "TMS_T2"), reverse=TRUE)
test_raw_data_format(filtered)
expect_equal(length(filtered$localities), 3)
expect_equal(length(filtered$localities$A1E05$loggers), 2)
expect_equal(length(filtered$localities$A1E05$loggers[[1]]$sensors), 1)
expect_equal(length(filtered$localities$A1E05$loggers[[2]]$sensors), 2)
expect_equal(length(filtered$localities$A2E32$loggers[[1]]$sensors), 2)
expect_equal(length(filtered$localities$A6W79$loggers[[1]]$sensors), 4)
expect_error(filtered <- mc_filter(data, c("A6W79", "A2E32", "A1E05"), "TMS_T2", reverse=TRUE))
})
test_that("mc_filter agg format", {
cleaned_data <- mc_read_data("../data/TOMST/files_table.csv", silent=T)
agg_data <- mc_agg(cleaned_data)
filtered <- mc_filter(agg_data, c("A6W79", "A2E32", "A1E05"), "TMS_T2")
test_agg_data_format(filtered)
expect_equal(length(filtered$localities), 2)
expect_equal(length(filtered$localities$A2E32$sensors), 1)
expect_equal(length(filtered$localities$A6W79$sensors), 1)
expect_false("TMS_T1" %in% names(filtered$localities$A6W79$sensors))
expect_true("TMS_T2" %in% names(filtered$localities$A6W79$sensors))
})
test_that("mc_filter reverse agg format", {
cleaned_data <- mc_read_data("../data/TOMST/files_table.csv", silent=T)
agg_data <- mc_agg(cleaned_data)
expect_error(filtered <- mc_filter(agg_data, "A6W79", "Thermo_T", reverse=T))
filtered <- mc_filter(agg_data, sensors="Thermo_T", reverse=T)
test_agg_data_format(filtered)
expect_equal(length(filtered$localities), 2)
expect_equal(length(filtered$localities$A2E32$sensors), 4)
})
test_that("mc_filter logger_types", {
cleaned_data <- mc_read_data("../data/TOMST/files_table.csv", silent=T)
agg_data <- mc_agg(cleaned_data)
expect_error(filtered <- mc_filter(agg_data, logger_types="TMS"))
filtered <- mc_filter(cleaned_data, logger_types="TMS")
expect_equal(names(filtered$localities), c("A2E32", "A6W79"))
filtered <- mc_filter(cleaned_data, logger_types="TMS", reverse=TRUE)
expect_equal(names(filtered$localities), c("A1E05"))
filtered <- mc_filter(cleaned_data, sensors="TMS_T1", logger_types="TMS")
expect_equal(length(filtered$localities), 2)
expect_equal(names(filtered$localities$A2E32$loggers[[1]]$sensors), "TMS_T1")
expect_error(filtered <- mc_filter(cleaned_data, sensors="TMS_T1", logger_types="Thermo", reverse = TRUE))
expect_error(filtered <- mc_filter(cleaned_data, localities="A1E05", logger_types="TMS"))
expect_error(filtered <- mc_filter(cleaned_data, localities="A1E05", logger_types="TMS", reverse = TRUE))
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.