The mammalsmilks package has an overview of loading data. https://brouwern.github.io/mammalsmilk/articles/b1-data_access.html
Chapters 10 (Loading data from .csv files into RStudio) and 11 (Loading Excel spreadsheets into RStudio) of the class workshop also contains information.
Use the cor() function in base R or psych::corr.test().
cor(iris[,-5])
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> Sepal.Length 1.0000000 -0.1175698 0.8717538 0.8179411
#> Sepal.Width -0.1175698 1.0000000 -0.4284401 -0.3661259
#> Petal.Length 0.8717538 -0.4284401 1.0000000 0.9628654
#> Petal.Width 0.8179411 -0.3661259 0.9628654 1.0000000
psych::corr.test(iris[,-5])
#> Call:psych::corr.test(x = iris[, -5])
#> Correlation matrix
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> Sepal.Length 1.00 -0.12 0.87 0.82
#> Sepal.Width -0.12 1.00 -0.43 -0.37
#> Petal.Length 0.87 -0.43 1.00 0.96
#> Petal.Width 0.82 -0.37 0.96 1.00
#> Sample Size
#> [1] 150
#> Probability values (Entries above the diagonal are adjusted for multiple tests.)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> Sepal.Length 0.00 0.15 0 0
#> Sepal.Width 0.15 0.00 0 0
#> Petal.Length 0.00 0.00 0 0
#> Petal.Width 0.00 0.00 0 0
#>
#> To see confidence intervals of the correlations, print with the short=FALSE option
Do any of the followings statements apply to your data? If true, you might have to deal with non-independence.
Do any of the followings statements apply to your data? If true, you might not have.