tests/testthat/test_t_time_difference.R

# Print title
cat("\nTesting t_time_difference()\n")

# Test time difference in seconds ----------------------------------------------

# Get data
data(psyo)
seconds <- psyosphere::t_time_difference(psyo)

# Check results
if (NCOL(seconds) != 6) { stop("Not enough columns") }
if (NROW(seconds) != 15) { stop("Not rows") }
e <- val_psyo(seconds); if (e != "") {stop(e)}
seconds_sum <- sum(seconds[,c("time_difference")], na.rm = TRUE)
if (seconds_sum != 323) {
  stop("Time difference is not as expected.")
}

Try the psyosphere package in your browser

Any scripts or data that you put into this service are public.

psyosphere documentation built on July 2, 2020, 12:08 a.m.