Verified Commit dcff2e6a authored by Cody L Marquart's avatar Cody L Marquart
Browse files

Prepping for v0.2.0.0

parent f5c87b31
Pipeline #47522 failed with stages
in 3 minutes and 18 seconds
......@@ -16,7 +16,7 @@ Imports:
rhoR,
cli
Suggests:
testthat,
testthat (>= 2.1.0),
magrittr,
knitr,
rmarkdown
......
# v0.2.0.0
Fixed bug in handcode() when there were newlines present
Restructed statistical history on codes
test() defaults kappa_threshold to 0.9
Codes now contain a holdout set and a set of touchable excerpts
Simplified retrieving of handsets for coding, along with randomizing the order
Bugfix: handcode() bug fixed that didn't show full excerpt when there was a newline
Bugfix: Fixed bug when retreiving differences in code sets using differences()
......@@ -3,8 +3,12 @@
\section{Changes in nodeR version 0.2.0.0 (2019-10-09)}{
\itemize{
\item \code{handcode()} bug fixed that didn't show full excerpt when there was a newline.
\item Restructed statistical history on codes
\item \code{test()} defaults kappa_threshold to 0.9
\item Codes now contain a holdout set and a set of touchable excerpts.
\item Simplified retrieving of handsets for coding, along with randomizing the order
\item Bugfix: \code{handcode()} bug fixed that didn't show full excerpt when there was a newline.
\item Bugfix: Fixed bug when retreiving differences in code sets using \code{differences()}
}
}
......
data(RS.data)
rs_text = RS.data$text
test_that("Verify old parameter", {
testthat::test_that("Verify old parameter", {
name <- "Data"
set <- 10:15
exprs <- c("number","priority")
......@@ -12,7 +12,7 @@ test_that("Verify old parameter", {
testthat::expect_warning(test(code = newcode, kappaThreshold = 0.9))
})
test_that("Verify statistics output", {
testthat::test_that("Verify statistics output", {
name <- "Data"
set <- 10:15
exprs <- c("number","priority")
......@@ -32,7 +32,7 @@ test_that("Verify statistics output", {
coded
)
})
test_that("Verify second rater stats", {
testthat::test_that("Verify second rater stats", {
name <- "Data"
set <- 10:15
second_set <- c(1, rep(x = 0, length(set) - 1))
......@@ -45,7 +45,7 @@ test_that("Verify second rater stats", {
newcode$secondRaterSet <- newcode$computerSet
newcode$secondRaterSet$Data <- second_set
newcode <- test(newcode)
newcode <- suppressWarnings(test(newcode))
gold_set <- newcode$statistics[[1]]$one_v_two$test_set$set[,2]
silv_set <- newcode$statistics[[1]]$one_v_two$test_set$set[,3]
......@@ -53,7 +53,7 @@ test_that("Verify second rater stats", {
testthat::expect_equal(gold_set, rep(0, length(set)))
testthat::expect_equal(silv_set, second_set)
})
test_that("Verify stats history", {
testthat::test_that("Verify stats history", {
name <- "Data"
set <- 10:15
exprs <- c("number","priority")
......@@ -63,27 +63,28 @@ test_that("Verify stats history", {
handcode(this.set = set, results = 0) %>%
test()
newcode <- handcode(code = newcode, this.set = 200:205, results = 1) %>% test()
newcode <- handcode(code = newcode, this.set = 200:205, results = 1)
newcode <- suppressWarnings(newcode %>% test())
first_stats <- newcode$statistics[[1]]
second_stats <- newcode$statistics[[2]]
expect_equal(length(newcode$statistics), 2)
})
test_that("Verify clearing of test set", {
testthat::test_that("Verify clearing of test set", {
name <- "Data"
set <- 10:15
exprs <- c("number","priority")
coded <- sapply(rs_text[set], grepl, pattern = paste0(exprs, collapse = "|")) * 1
newcode <- create.code(name, expressions = exprs, excerpts = rs_text) %>%
handcode(this.set = set, results = 0) %>%
test()
handcode(this.set = set, results = 0)
newcode <- suppressWarnings(newcode %>% test())
first_stats <- newcode$statistics[[1]]
expect_equal(nrow(first_stats$one_v_classifier$test_set$set), length(coded))
expect_null(first_stats$one_v_classifier$training_set$set)
newcode_w_training <- handcode(code = newcode, this.set = 200:205, results = 1) %>% test()
newcode_w_training <- suppressWarnings(handcode(code = newcode, this.set = 200:205, results = 1) %>% test())
second_stats <- newcode_w_training$statistics[[2]]
......
data(RS.data)
rs_text = RS.data$text
test_that("code summary", {
name <- "Data"
set <- 10:15
exprs <- c("number","priority")
coded <- sapply(rs_text[set], grepl, pattern = paste0(exprs, collapse = "|")) * 1
newcode <- create.code(name, expressions = exprs, excerpts = rs_text) %>%
handcode(this.set = set, results = 0) %>%
test()
tmp <- tempfile()
on.exit(unlink(tmp), add = TRUE)
sink(tmp)
summary(newcode)
summ_output <- readLines(tmp)
unlink(tmp)
sink(file = NULL)
testthat::expect_false(
any(grepl(pattern = "NULL", x = summ_output))
)
})
......@@ -10,11 +10,11 @@ test_that("Basic second rater", {
newcode <- create.code(name, expressions = exprs, excerpts = rs_text) %>%
handcode(this.set = set, results = 0)
newcode <- test(code = newcode, kappa_threshold = 0.9)
newcode <- suppressWarnings(test(code = newcode, kappa_threshold = 0.9))
testthat::expect_equal(length(newcode$statistics), 1)
newcode$secondRaterSet <- data.frame(ID = newcode$testSet[,1], newcode$computerSet[,2])
newcode <- test(code = newcode, kappa_threshold = 0.9)
newcode <- suppressWarnings(test(code = newcode, kappa_threshold = 0.9))
testthat::expect_equal(length(newcode$statistics), 2)
testthat::expect_equal(newcode$statistics[[2]]$two_v_classifier$test_set$kappa, 1)
testthat::expect_null(newcode$statistics[[2]]$one_v_two$training_set)
......@@ -33,10 +33,10 @@ test_that("Second rater training set", {
test(kappa_threshold = 0.9)
newcode$secondRaterSet <- data.frame(ID = newcode$testSet[,1], newcode$computerSet[,2])
newcode <- test(code = newcode, kappa_threshold = 0.9)
newcode <- suppressWarnings(test(code = newcode, kappa_threshold = 0.9))
newcode <- handcode(code = newcode, this.set = set_two, results = 0) %>%
test(kappa_threshold = 0.9)
newcode <- suppressWarnings(handcode(code = newcode, this.set = set_two, results = 0) %>%
test(kappa_threshold = 0.9))
testthat::expect_null(newcode$statistics[[3]]$one_v_two$test_set)
testthat::expect_equal(newcode$statistics[[3]]$one_v_two$training_set$set$ID, set_one)
......@@ -44,7 +44,7 @@ test_that("Second rater training set", {
newcode$secondRaterSet,
data.frame(ID = newcode$testSet[,1], "Data" = 1)
)
newcode <- test(code = newcode, kappa_threshold = 0.9)
newcode <- suppressWarnings(test(code = newcode, kappa_threshold = 0.9))
newcode$statistics[[4]]$one_v_two$test_set
testthat::expect_false(is.null(newcode$statistics[[4]]$one_v_two$test_set))
testthat::expect_equal(newcode$statistics[[4]]$one_v_two$training_set$set$ID, set_one)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment