cor.test
can't be applied on a data.frame or a matrix. See this SO thread.
Following the aforementioned thread's accepted answer, here's a solution using corr.test
function from psych
package:
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(psych)
complete_dataset <- read.csv(file = 'https://raw.githubusercontent.com/BrainStormCenter/ASQ_pilot/master/ASQ_pilot_raw_2019_04_17.csv')
small_subset <- complete_dataset %>%
# as far as I can see, there's not a single participant with "other" as Group3
filter(Groups3 != "other") %>%
select(asq_light, asq_heavy, max.temp)
correlation_matrix <- corr.test(x = small_subset,
use = "complete", # available: pairwise, complete
method = "pearson", # available: pearson, spearman, kendall
adjust = "none") # available: holm, hochberg, hommel, bonferroni, BH, BY, fd, none
print(x = correlation_matrix,
short = FALSE)
#> Call:corr.test(x = small_subset, use = "complete", method = "pearson",
#> adjust = "none")
#> Correlation matrix
#> asq_light asq_heavy max.temp
#> asq_light 1.00 0.36 0.05
#> asq_heavy 0.36 1.00 0.19
#> max.temp 0.05 0.19 1.00
#> Sample Size
#> [1] 55
#> Probability values (Entries above the diagonal are adjusted for multiple tests.)
#> asq_light asq_heavy max.temp
#> asq_light 0.00 0.01 0.69
#> asq_heavy 0.01 0.00 0.16
#> max.temp 0.69 0.16 0.00
#>
#> Confidence intervals based upon normal theory. To get bootstrapped values, try cor.ci
#> raw.lower raw.r raw.upper raw.p lower.adj upper.adj
#> asq_l-asq_h 0.11 0.36 0.57 0.01 0.05 0.61
#> asq_l-mx.tm -0.21 0.05 0.32 0.69 -0.27 0.37
#> asq_h-mx.tm -0.08 0.19 0.44 0.16 -0.14 0.48
Created on 2019-04-18 by the reprex package (v0.2.1)