Skip to content
/ apa.cor Public

Create a correlation matrix from a a dataframe, including means, standard deviations and significance levels.

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

GGLuca/apa.cor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apa.cor - A correlation matrix in R, using APA style

GitHub last commit

What it does:

This single-function package is designed to be a fast way of creating a correlation matrix from a dataframe that includes the needed variables. It also produces means, standard deviations and NHS significance tests at various levels, with an export function for the clipboard.

It is also a good tool of creating an S3 object that plugs in well into the papaja: Prepare APA Journal Articles with R Markdown package, to produce a correlation table afer the APA manuscript guidelines.

Installation

To install the latest (see latest changes below), type the following commands into the R console:

library(devtools)
devtools::install_github("GGLuca/apa.cor")

Example of Recommended Usage

To create a correlation matrix for the Agreeableness items from the bfidataset (psych package, 25 Personality items representing 5 factors):

library(tidyverse)    # load Tidyverse
library(psych)        # load package psych for the `bfi`dataset
library(apa.cor)

bfi %>% 
  select(A1:A5) %>% 
  apa.cor()
##       M   SD      1     2     3     4
## A1 2.41 1.41                         
## A2 4.80 1.17 -.34**                  
## A3 4.60 1.30 -.27** .49**            
## A4 4.70 1.48 -.15** .34** .36**      
## A5 4.56 1.26 -.18** .39** .50** .31**

Supplemental Argument

The function also has an export option export = TRUE, that copies the output into the clipboard, for further manipulation such a simple paste into Microsoft Word.

apa.cor(x, export = TRUE)

Better usage

Since the function outputs a proper S3 object, it is perfect for integrating it into the papaja package, be it to create html tables or better yet, beautifully formatted PDF files.

library(papaja)

bfi %>% 
  select(A1:A5) %>% 
  apa.cor() %>% 

apa_table(
  .,
  , caption = "Variable Means, Standard Deviations, and Correlations Between Agreeableness Items"
  , note = "This table was created with apa_table()."
  , escape = TRUE
)
(#tab:unnamed-chunk-4)

Variable Means, Standard Deviations, and Correlations Between Agreeableness Items

M SD 1 2 3 4
A1 2.41 1.41
A2 4.80 1.17 -.34**
A3 4.60 1.30 -.27** .49**
A4 4.70 1.48 -.15** .34** .36**
A5 4.56 1.26 -.18** .39** .50** .31**

Note. This table was created with apa_table().

 

About

Create a correlation matrix from a a dataframe, including means, standard deviations and significance levels.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published