Hi,
I am getting following problem when I try to knit my work into pdf:
[Error in rcorr(data_rcorr) : could not find function "rcorr"
Calls: ... handle -> withCallingHandlers -> withVisible -> eval -> eval
Execution halted
Can any body help me in this regards?
Khurram
mara
June 25, 2019, 2:48pm
2
You need to have the library that contains the function in your document in order for the function to be used. I'm guessing you're looking for rcorr()
from the Hmisc package. So, you can either attack Hmisc, or prefix it Hmisc::rcorr()
.
Thanks Mara!
The problem still exists after installing the package. This function works when I try to run junk but it could not create pdf file through knit function. Can you please try this with your codes in rmarkdown?
Thank you!
mara
June 25, 2019, 5:50pm
4
It's not about installation, it's about calling the library first. Here's a gist with the .Rmd
and the .md
, which I just knit successfully.
rcorr_test.Rmd
---
title: '`rcorr()` test'
author: "Mara Averick"
date: "6/25/2019"
output:
html_document:
keep_md: TRUE
---
```{r setup, include=FALSE}
This file has been truncated. show original
rcorr_test.md
---
title: '`rcorr()` test'
author: "Mara Averick"
date: "6/25/2019"
output:
html_document:
keep_md: TRUE
---
This file has been truncated. show original
The body of the Rmd here, too.
---
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))
```
system
Closed
July 3, 2019, 10:26am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.