I have the following code to calculate within- and between-person correlations of a multilevel dataset:
library(psych)
corrdata <- dat %>%
select(id, var1, var2)
between_within_corr <- statsBy(corrdata, group = "id", cors = TRUE,
cor="cor", method="pearson", use="pairwise", poly=FALSE,
na.rm=TRUE,alpha=.05,minlength=5,weights=NULL)
print(between_within_corr, short = FALSE)
How do i add p-values to the correlational coefficients?