diff --git a/R/frequency-tables.R b/R/frequency-tables.R index 2fd33bb..1a03c12 100644 --- a/R/frequency-tables.R +++ b/R/frequency-tables.R @@ -134,7 +134,8 @@ summarise_coding_tools <- function(data, type = list("knowledge", "access"), pro questions <- questions[grepl(paste0(type, "_"), questions)] - frequencies <- calculate_freqs(data, questions, levels, labels, prop = prop) + frequencies <- calculate_freqs(data, questions, levels, labels, prop = prop) %>% + dplyr::arrange(match(name, c("Python", "R", "SQL", "Matlab", "SAS", "SPSS", "Stata", "VBA"))) return(frequencies) } @@ -428,7 +429,7 @@ summarise_rap_comp <- function(data) { "Team open source code", "Version control", "Peer review", - "Development QA", + "Proportionate QA", "Documentation", "Functions", "Unit testing", @@ -442,7 +443,7 @@ summarise_rap_comp <- function(data) { "open_code_score", "version_control_score", "peer_review_score", - "development_QA_score", + "proportionate_QA_score", "doc_score", "function_score", "unit_test_score", diff --git a/tests/testthat/test-summarise_coding_tools.R b/tests/testthat/test-summarise_coding_tools.R index 477a8ff..4288e4b 100644 --- a/tests/testthat/test-summarise_coding_tools.R +++ b/tests/testthat/test-summarise_coding_tools.R @@ -33,17 +33,17 @@ test_that("summarise_coding_tools knowledge output is as expected", { got_knowledge <- summarise_coding_tools(dummy_data, "knowledge") - expected_knowledge <- data.frame(name = rep(c("Matlab", - "Python", + expected_knowledge <- data.frame(name = rep(c("Python", "R", + "SQL", + "Matlab", "SAS", "SPSS", - "SQL", "Stata", "VBA"), each=3), value = factor(rep(c("Yes", "No", "Not required for my work"), 8), levels = c("Yes", "No", "Not required for my work")), - n = c(1/3, 2/3, 0, rep(1/3, times=21)) + n = c(rep(1/3, times=9), 1/3, 2/3, 0, rep(1/3, times=12)) ) expect_equal(got_knowledge, expected_knowledge) @@ -54,17 +54,17 @@ test_that("summarise_coding_tools access output is as expected", { got_access <- summarise_coding_tools(dummy_data, "access") - expected_access <- data.frame(name = rep(c("Matlab", - "Python", + expected_access <- data.frame(name = rep(c("Python", "R", + "SQL", + "Matlab", "SAS", "SPSS", - "SQL", "Stata", "VBA"), each=3), value = factor(rep(c("Yes", "No", "Don't know"), 8), levels = c("Yes", "No", "Don't know")), - n = c(1/3, 2/3, 0, rep(1/3, times=21)) + n = c(rep(1/3, times=9), 1/3, 2/3, 0, rep(1/3, times=12)) ) expect_equal(got_access, expected_access) diff --git a/tests/testthat/test-summarise_languages_by_prof.R b/tests/testthat/test-summarise_languages_by_prof.R index 74b0045..41393c4 100644 --- a/tests/testthat/test-summarise_languages_by_prof.R +++ b/tests/testthat/test-summarise_languages_by_prof.R @@ -4,7 +4,7 @@ knowledge_response <- rep(c( NA, "Yes", "No", - "Don't know"), + "Not required for my work"), each = 3, times = 6) prof_response <- rep(c( @@ -61,12 +61,12 @@ test_that("summarise_languages_by_prof output is as expected", { expected <- data.frame( lang = rep(c( - "Matlab", "Python", "R", + "SQL", + "Matlab", "SAS", "SPSS", - "SQL", "Stata", "VBA"), times = 9), diff --git a/tests/testthat/test-summarise_os_vs_prop.R b/tests/testthat/test-summarise_os_vs_prop.R index 4500aa6..0a66c3d 100644 --- a/tests/testthat/test-summarise_os_vs_prop.R +++ b/tests/testthat/test-summarise_os_vs_prop.R @@ -20,8 +20,8 @@ test_that("summarise_os_vs_prop output is as expected", { got <- summarise_os_vs_prop(dummy_data) - expected <- data.frame(lang_type = factor(rep(c("open source", "proprietary"), each=3), - levels = c("open source", "proprietary")), + expected <- data.frame(lang_type = factor(rep(c("Open Source", "Proprietary"), each=3), + levels = c("Open Source", "Proprietary")), year = rep(c("2020", "2021", "2022"), times=2), Freq = rep(c(24, 28), each=3), n = rep(32, times=6)) %>% diff --git a/tests/testthat/test-summarise_rap_comp.R b/tests/testthat/test-summarise_rap_comp.R index f77bde3..5355423 100644 --- a/tests/testthat/test-summarise_rap_comp.R +++ b/tests/testthat/test-summarise_rap_comp.R @@ -13,7 +13,7 @@ dummy_data <- data.frame( open_code_score = rep(c(NA, 1, 0), times = 5), version_control_score = rep(c(NA, 1, 0), times = 5), peer_review_score = rep(c(NA, 1, 0), times = 5), - development_QA_score = rep(c(NA, 1, 0), times = 5), + proportionate_QA_score = rep(c(NA, 1, 0), times = 5), doc_score = rep(c(NA, 1, 0), times = 5), basic_rap_score = rep(c(NA, 1, 0), times = 5), function_score = rep(c(NA, 1, 0), times = 5), @@ -48,7 +48,7 @@ test_that("summarise_rap_comp output is as expected", { "Team open source code", "Version control", "Peer review", - "Development QA", + "Proportionate QA", "Documentation", "Functions", "Unit testing", @@ -62,7 +62,7 @@ test_that("summarise_rap_comp output is as expected", { "Team open source code", "Version control", "Peer review", - "Development QA", + "Proportionate QA", "Documentation", "Functions", "Unit testing",