Skip to content

Instantly share code, notes, and snippets.

@richarddmorey
Last active March 25, 2022 09:26
Show Gist options
  • Save richarddmorey/2448ded384c8789a8534cf2009795a87 to your computer and use it in GitHub Desktop.
Save richarddmorey/2448ded384c8789a8534cf2009795a87 to your computer and use it in GitHub Desktop.
Testing the ricv package with Rmarkdown
---
title: "Testing ricv"
author: "Richard D. Morey"
date: "3/25/2022"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
```{r}
# devtools::install_github("xvrdm/ricv")
library(dplyr)
library(ggplot2)
library(ricv)
set.seed(1)
N = 100
sig_e = .2
tibble(
x = runif(N),
y = x + rnorm(N,0,sig_e)
) %>%
ggplot(aes(x=x,y=y)) +
geom_point() +
theme_minimal() -> gg
f1 = tempfile(fileext = '.jpg') %>% basename() %>% paste0('img/', .)
f2 = tempfile(fileext = '.jpg') %>% basename() %>% paste0('img/', .)
ggsave(f1,gg)
ggsave(f2,gg + geom_smooth())
```
```{r}
knitr::include_graphics(f1)
```
```{r}
knitr::include_graphics(f2)
```
```{r}
ricv(img1 = f1, img2 = f2,
options = list(addCircle = TRUE, hoverStart = TRUE))
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment