Skip to content

Instantly share code, notes, and snippets.

@batpigandme
Created June 25, 2019 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save batpigandme/a3c01e3e4077619004314aa669f87905 to your computer and use it in GitHub Desktop.
Save batpigandme/a3c01e3e4077619004314aa669f87905 to your computer and use it in GitHub Desktop.
rcorr_test
title author date output
`rcorr()` test
Mara Averick
6/25/2019
html_document
keep_md
true
library(Hmisc)
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## Loading required package: ggplot2
## 
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:base':
## 
##     format.pval, units
x <- c(-2, -1, 0, 1, 2)
y <- c(4,   1, 0, 1, 4)
z <- c(1,   2, 3, 4, NA)
v <- c(1,   2, 3, 4, 5)
rcorr(cbind(x,y,z,v))
##   x     y     z v
## x 1  0.00  1.00 1
## y 0  1.00 -0.75 0
## z 1 -0.75  1.00 1
## v 1  0.00  1.00 1
## 
## n
##   x y z v
## x 5 5 4 5
## y 5 5 4 5
## z 4 4 4 4
## v 5 5 4 5
## 
## P
##   x      y      z      v     
## x        1.0000 0.0000 0.0000
## y 1.0000        0.2546 1.0000
## z 0.0000 0.2546        0.0000
## v 0.0000 1.0000 0.0000
---
title: '`rcorr()` test'
author: "Mara Averick"
date: "6/25/2019"
output:
html_document:
keep_md: TRUE
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, collapse = TRUE)
```
```{r}
library(Hmisc)
```
```{r}
x <- c(-2, -1, 0, 1, 2)
y <- c(4, 1, 0, 1, 4)
z <- c(1, 2, 3, 4, NA)
v <- c(1, 2, 3, 4, 5)
rcorr(cbind(x,y,z,v))
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment