Good catch!
Please indicate that you have solved the problem by flagging your last remark as the solution.
This prevents other forum members looking at it, only to notice later that it is already solved.
You could also indicate your problem to the maintainer of the lsr
package in
https://github.com/svannoy/lsr-package/issues .
I think it is very easy for him/her to avoid this kind of problems.
Just open a new issue and copy the code below:
(alternatively I could do this, but as you found problem and solution ....
Just let me know.)
library(tibble)
#> Warning: package 'tibble' was built under R version 4.1.2
library(lsr)
#> Warning: package 'lsr' was built under R version 4.1.2
amytest <- tribble(
~ID, ~scoreT1, ~scoreT2, ~Group,
"ID_001", 3, 5, 1,
"ID_002", 2, 6, 1,
"ID_003", 4, 8, 1,
"ID_004", 3, 6, 1,
"ID_005", 2, 6, 1,
"ID_006", 2, 3, 2,
"ID_007", 3, 3, 2,
"ID_008", 2, 2, 2,
"ID_009", 4, 3, 2,
"ID_010", 3, 3, 2,
)
pairedSamplesTTest( formula = ~scoreT1 + scoreT2,data=amytest)
#> Error in pairedSamplesTTest(formula = ~scoreT1 + scoreT2, data = amytest): 'scoreT1' is not numeric
amytest2 <- as.data.frame(amytest)
pairedSamplesTTest( formula = ~scoreT1 + scoreT2,data=amytest2)
#>
#> Paired samples t-test
#>
#> Variables: scoreT1 , scoreT2
#>
#> Descriptive statistics:
#> scoreT1 scoreT2 difference
#> mean 2.800 4.500 -1.700
#> std dev. 0.789 1.958 1.947
#>
#> Hypotheses:
#> null: population means equal for both measurements
#> alternative: different population means for each measurement
#>
#> Test results:
#> t-statistic: -2.762
#> degrees of freedom: 9
#> p-value: 0.022
#>
#> Other information:
#> two-sided 95% confidence interval: [-3.092, -0.308]
#> estimated effect size (Cohen's d): 0.873
Created on 2022-02-23 by the reprex package (v2.0.1)