From 1ef54f94d897be7778e341c9b112cb572c203677 Mon Sep 17 00:00:00 2001 From: Qinyun Lin Date: Wed, 24 Jul 2024 18:21:20 +0200 Subject: [PATCH] update warning message for --- R/cop_pse_auxiliary.R | 2 +- tests/testthat/test-auxillary.R | 2 +- tests/testthat/test-cop_pse_auxiliary.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/cop_pse_auxiliary.R b/R/cop_pse_auxiliary.R index 643a21b..0a90cff 100644 --- a/R/cop_pse_auxiliary.R +++ b/R/cop_pse_auxiliary.R @@ -9,7 +9,7 @@ cal_ryz <- function(ryxGz, R2){ if (R2yz >= 0) { ryz <- sqrt(R2yz) } else { - stop("The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. The unconditional ITCV is not conceptualized for\n this scenario.") + stop("The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. Note: the unconditional ITCV is not conceptualized\n for this scenario.") } return(ryz) } diff --git a/tests/testthat/test-auxillary.R b/tests/testthat/test-auxillary.R index 5e3fe35..c506458 100644 --- a/tests/testthat/test-auxillary.R +++ b/tests/testthat/test-auxillary.R @@ -3,7 +3,7 @@ context("Checking auxiliary") test_that("cal_ryz works", { expect_equal(cal_ryz(0.1, 0.6), tolerance = .001, 0.7719842) expect_equal(cal_ryz(0.2, 0.6), tolerance = .001, 0.7637626) - expect_error(expect_message(cal_ryz(0.6, 0.2)), "The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. The unconditional ITCV is not conceptualized for\n this scenario.") + expect_error(expect_message(cal_ryz(0.6, 0.2)), "The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. Note: the unconditional ITCV is not conceptualized\n for this scenario.") }) test_that("cal_rxz works", { diff --git a/tests/testthat/test-cop_pse_auxiliary.R b/tests/testthat/test-cop_pse_auxiliary.R index 4281e3d..344f6d5 100644 --- a/tests/testthat/test-cop_pse_auxiliary.R +++ b/tests/testthat/test-cop_pse_auxiliary.R @@ -3,7 +3,7 @@ context("Checking auxiliary") test_that("cal_ryz works", { expect_equal(cal_ryz(0.1, 0.6), tolerance = .001, 0.7719842) expect_equal(cal_ryz(0.2, 0.6), tolerance = .001, 0.7637626) - expect_error(expect_message(cal_ryz(0.6, 0.2)), "The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. The unconditional ITCV is not conceptualized for\n this scenario.") + expect_error(expect_message(cal_ryz(0.6, 0.2)), "The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. Note: the unconditional ITCV is not conceptualized\n for this scenario.") }) test_that("cal_rxz works", {