R/manual_scripts/profiling_code.r

# ---------- Lines to use to profile a running app
# install.packages("profvis")
# library(profvis)
# profvis::profvis({ runApp() })

#
# profvis(prof_input = 'profiles.Rprof')

# ---------- Lines to use to profile specific R code (currently laid out for a function against a refactored version)

# profvis({
#   # data <- fread("tests/testthat/test-data/passes_everything.csv", encoding = "UTF-8", colClasses = c("character"), na.strings = NULL)
#   # meta <- fread("tests/testthat/test-data/passes_everything.meta.csv", encoding = "UTF-8", colClasses = c("character"), na.strings = NULL)
#
#   # ---- Old code
#
#   old <- function() {
#     "School" %in% unlist(distinct(data, geographic_level), use.names = FALSE)
#   }
#
#   old()
#
#   # ---- Potential new code
#
#   new <- function() {
#     "School" %in% unique(data$geographic_level)
#   }
#
#   new()
# })
dfe-analytical-services/dfe-published-data-qa documentation built on July 17, 2025, 12:15 a.m.