gadenbuie / xaringanExtra

:ferris_wheel: A playground of enhancements and extensions for xaringan slides.
https://pkg.garrickadenbuie.com/xaringanExtra
Other
445 stars 36 forks source link

.can-edit[] freezing RStudio #187

Closed rmharp closed 9 months ago

rmharp commented 9 months ago

This freezes my entire RStudio when knitting any time I attempt to call .can-edit[]. To clarify, I'm able to load xaringanExtra::use_editable(expires = 1) but when attempting to use the function my R will freeze completely to the point that I can't even quit without using force quit.

gadenbuie commented 9 months ago

Hi @rmharp! I just tried to reproduce the issue by rendering xaringanExtra's editable example slides and I could not reproduce the problem.

Could you share the results of sessioninfo::session_info()? It would also be helpful to send me a small R Markdown document that reproduces the problem for you.

Here's my session info:

─ Session info ──────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.1 (2023-06-16)
 os       macOS Ventura 13.6
 system   x86_64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/New_York
 date     2023-10-06
 rstudio  2023.09.0+463 Desert Sunflower (desktop)
 pandoc   3.1.2 @ /usr/local/bin/ (via rmarkdown)

─ Packages ──────────────────────────────────────────────────────────────────────────────────────
 package       * version    date (UTC) lib source
 cachem          1.0.8      2023-05-01 [1] CRAN (R 4.3.0)
 callr           3.7.3      2022-11-02 [1] CRAN (R 4.3.0)
 cli             3.6.1      2023-03-23 [1] CRAN (R 4.3.0)
 crayon          1.5.2      2022-09-29 [1] CRAN (R 4.3.0)
 data.table      1.14.8     2023-02-17 [1] CRAN (R 4.3.0)
 devtools      * 2.4.5      2022-10-11 [1] CRAN (R 4.3.0)
 digest          0.6.33     2023-07-07 [1] CRAN (R 4.3.0)
 ellipsis        0.3.2      2021-04-29 [1] CRAN (R 4.3.0)
 evaluate        0.22       2023-09-29 [1] CRAN (R 4.3.0)
 fansi           1.0.4      2023-01-22 [1] CRAN (R 4.3.0)
 fastmap         1.1.1      2023-02-24 [1] CRAN (R 4.3.0)
 fs              1.6.3      2023-07-20 [1] CRAN (R 4.3.0)
 generics        0.1.3      2022-07-05 [1] CRAN (R 4.3.0)
 glue            1.6.2      2022-02-24 [1] CRAN (R 4.3.0)
 hms             1.1.3      2023-03-21 [1] CRAN (R 4.3.0)
 htmltools       0.5.6      2023-08-10 [1] CRAN (R 4.3.0)
 htmlwidgets     1.6.2      2023-03-17 [1] CRAN (R 4.3.0)
 httpuv          1.6.11     2023-05-11 [1] CRAN (R 4.3.0)
 httr            1.4.7      2023-08-15 [1] CRAN (R 4.3.0)
 ipapi           0.1        2023-08-30 [1] Github (hrbrmstr/ipapi@c612329)
 jsonlite        1.8.7      2023-06-29 [1] CRAN (R 4.3.0)
 knitr           1.44       2023-09-11 [1] CRAN (R 4.3.0)
 later           1.3.1      2023-05-02 [1] CRAN (R 4.3.0)
 lifecycle       1.0.3      2022-10-07 [1] CRAN (R 4.3.0)
 lubridate       1.9.3      2023-09-27 [1] CRAN (R 4.3.0)
 magrittr        2.0.3      2022-03-30 [1] CRAN (R 4.3.0)
 memoise         2.0.1      2021-11-26 [1] CRAN (R 4.3.0)
 mime            0.12       2021-09-28 [1] CRAN (R 4.3.0)
 miniUI          0.1.1.1    2018-05-18 [1] CRAN (R 4.3.0)
 pbapply         1.7-2      2023-06-27 [1] CRAN (R 4.3.0)
 pillar          1.9.0      2023-03-22 [1] CRAN (R 4.3.0)
 pkgbuild        1.4.2      2023-06-26 [1] CRAN (R 4.3.0)
 pkgconfig       2.0.3      2019-09-22 [1] CRAN (R 4.3.0)
 pkgload         1.3.3      2023-09-22 [1] CRAN (R 4.3.0)
 praise          1.0.0      2015-08-11 [1] CRAN (R 4.3.0)
 prettyunits     1.2.0      2023-09-24 [1] CRAN (R 4.3.0)
 processx        3.8.2      2023-06-30 [1] CRAN (R 4.3.0)
 profvis         0.3.8      2023-05-02 [1] CRAN (R 4.3.0)
 promises        1.2.1      2023-08-10 [1] CRAN (R 4.3.0)
 ps              1.7.5      2023-04-18 [1] CRAN (R 4.3.0)
 purrr           1.0.2      2023-08-10 [1] CRAN (R 4.3.0)
 R6              2.5.1      2021-08-19 [1] CRAN (R 4.3.0)
 rappdirs        0.3.3      2021-01-31 [1] CRAN (R 4.3.0)
 Rcpp            1.0.11     2023-07-06 [1] CRAN (R 4.3.0)
 remotes         2.4.2.1    2023-07-18 [1] CRAN (R 4.3.0)
 rlang           1.1.1      2023-04-28 [1] CRAN (R 4.3.0)
 rmarkdown       2.25       2023-09-18 [1] CRAN (R 4.3.0)
 roxygen2        7.2.3      2022-12-08 [1] CRAN (R 4.3.0)
 rsconnect       1.1.1      2023-10-04 [1] CRAN (R 4.3.0)
 rsthemes        0.4.0      2023-10-05 [1] Github (gadenbuie/rsthemes@34a55a4)
 rstudioapi      0.15.0     2023-07-07 [1] CRAN (R 4.3.0)
 sessioninfo     1.2.2      2021-12-06 [1] CRAN (R 4.3.0)
 shiny           1.7.5      2023-08-12 [1] CRAN (R 4.3.0)
 shrtcts         0.1.2      2023-10-04 [1] https://gadenbuie.r-universe.dev (R 4.3.1)
 stringi         1.7.12     2023-01-11 [1] CRAN (R 4.3.0)
 stringr         1.5.0      2022-12-02 [1] CRAN (R 4.3.0)
 suncalc         0.5.1      2022-09-29 [1] CRAN (R 4.3.0)
 tibble          3.2.1      2023-03-20 [1] CRAN (R 4.3.0)
 timechange      0.2.0      2023-01-11 [1] CRAN (R 4.3.0)
 urlchecker      1.0.1      2021-11-30 [1] CRAN (R 4.3.0)
 usethis       * 2.2.2      2023-07-06 [1] CRAN (R 4.3.0)
 utf8            1.2.3      2023-01-31 [1] CRAN (R 4.3.0)
 vctrs           0.6.3      2023-06-14 [1] CRAN (R 4.3.0)
 xaringan        0.28       2022-12-13 [1] CRAN (R 4.3.0)
 xaringanExtra * 0.7.0.9000 2023-10-06 [1] local
 xfun            0.40       2023-08-09 [1] CRAN (R 4.3.0)
 xml2            1.3.5      2023-07-06 [1] CRAN (R 4.3.0)
 xtable          1.8-4      2019-04-21 [1] CRAN (R 4.3.0)
 yaml            2.3.7      2023-01-23 [1] CRAN (R 4.3.0)

 [1] /Users/garrick/Library/R/x86_64/4.3/library
 [2] /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library

─────────────────────────────────────────────────────────────────────────────────────────────────
rmharp commented 9 months ago
─ Session info ────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.1 (2023-06-16)
 os       macOS Ventura 13.4.1
 system   aarch64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/New_York
 date     2023-10-06
 rstudio  2023.09.0+463 Desert Sunflower (desktop)
 pandoc   3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)

─ Packages ────────────────────────────────────────────────────────────────────────────
 package       * version    date (UTC) lib source
 askpass         1.2.0      2023-09-03 [1] CRAN (R 4.3.0)
 bit             4.0.5      2022-11-15 [1] CRAN (R 4.3.0)
 bit64           4.0.5      2020-08-30 [1] CRAN (R 4.3.0)
 bslib           0.5.1      2023-08-11 [1] CRAN (R 4.3.0)
 cachem          1.0.8      2023-05-01 [1] CRAN (R 4.3.0)
 chromote      * 0.1.2      2023-08-11 [1] CRAN (R 4.3.0)
 cli             3.6.1      2023-03-23 [1] CRAN (R 4.3.0)
 crayon          1.5.2      2022-09-29 [1] CRAN (R 4.3.0)
 digest          0.6.33     2023-07-07 [1] CRAN (R 4.3.0)
 dplyr         * 1.1.3      2023-09-03 [1] CRAN (R 4.3.0)
 evaluate        0.22       2023-09-29 [1] CRAN (R 4.3.1)
 fansi           1.0.4      2023-01-22 [1] CRAN (R 4.3.0)
 fastmap         1.1.1      2023-02-24 [1] CRAN (R 4.3.0)
 forcats         1.0.0      2023-01-29 [1] CRAN (R 4.3.0)
 fs              1.6.3      2023-07-20 [1] CRAN (R 4.3.0)
 generics        0.1.3      2022-07-05 [1] CRAN (R 4.3.0)
 glue          * 1.6.2      2022-02-24 [1] CRAN (R 4.3.0)
 haven         * 2.5.3      2023-06-30 [1] CRAN (R 4.3.0)
 highr           0.10       2022-12-22 [1] CRAN (R 4.3.0)
 hms             1.1.3      2023-03-21 [1] CRAN (R 4.3.0)
 htmltools     * 0.5.6      2023-08-10 [1] CRAN (R 4.3.0)
 jquerylib       0.1.4      2021-04-26 [1] CRAN (R 4.3.0)
 jsonlite        1.8.7      2023-06-29 [1] CRAN (R 4.3.0)
 knitr         * 1.44       2023-09-11 [1] CRAN (R 4.3.0)
 later           1.3.1      2023-05-02 [1] CRAN (R 4.3.0)
 lifecycle       1.0.3      2022-10-07 [1] CRAN (R 4.3.0)
 magrittr        2.0.3      2022-03-30 [1] CRAN (R 4.3.0)
 metathis      * 1.1.4      2023-07-11 [1] CRAN (R 4.3.0)
 pdftools      * 3.4.0      2023-09-25 [1] CRAN (R 4.3.1)
 pillar          1.9.0      2023-03-22 [1] CRAN (R 4.3.0)
 pkgconfig       2.0.3      2019-09-22 [1] CRAN (R 4.3.0)
 processx        3.8.2      2023-06-30 [1] CRAN (R 4.3.0)
 promises        1.2.1      2023-08-10 [1] CRAN (R 4.3.0)
 ps              1.7.5      2023-04-18 [1] CRAN (R 4.3.0)
 qpdf            1.3.2      2023-03-17 [1] CRAN (R 4.3.0)
 R6              2.5.1      2021-08-19 [1] CRAN (R 4.3.0)
 Rcpp            1.0.11     2023-07-06 [1] CRAN (R 4.3.0)
 readr         * 2.1.4      2023-02-10 [1] CRAN (R 4.3.0)
 renderthis    * 0.2.1      2023-10-06 [1] Github (jhelvy/renderthis@2b7138a)
 rlang           1.1.1      2023-04-28 [1] CRAN (R 4.3.0)
 rmarkdown       2.25       2023-09-18 [1] CRAN (R 4.3.1)
 rstudioapi      0.15.0     2023-07-07 [1] CRAN (R 4.3.0)
 sass            0.4.7      2023-07-15 [1] CRAN (R 4.3.0)
 sessioninfo     1.2.2      2021-12-06 [1] CRAN (R 4.3.0)
 tibble          3.2.1      2023-03-20 [1] CRAN (R 4.3.0)
 tidyselect      1.2.0      2022-10-10 [1] CRAN (R 4.3.0)
 tzdb            0.4.0      2023-05-12 [1] CRAN (R 4.3.0)
 utf8            1.2.3      2023-01-31 [1] CRAN (R 4.3.0)
 vctrs           0.6.3      2023-06-14 [1] CRAN (R 4.3.0)
 vroom           1.6.3      2023-04-28 [1] CRAN (R 4.3.0)
 websocket       1.4.1      2021-08-18 [1] CRAN (R 4.3.0)
 withr         * 2.5.1      2023-09-26 [1] CRAN (R 4.3.1)
 xaringan        0.28       2022-12-13 [1] CRAN (R 4.3.0)
 xaringanExtra * 0.7.0.9000 2023-10-06 [1] Github (gadenbuie/xaringanExtra@f394e92)
 xfun            0.40       2023-08-09 [1] CRAN (R 4.3.0)
 yaml            2.3.7      2023-01-23 [1] CRAN (R 4.3.0)

 [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
───────────────────────────────────────────────────────────────────────────────────────

and my code:

---
title: "BRANE Lab"
subtitle: 
author: "Riley Harper"
institute: "UNC-Chapel Hill"
date: "`r Sys.Date()`"
output:
  xaringan::moon_reader:
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: true
---
```{r include=FALSE}
library(chromote)
library(pdftools)
library(renderthis)
library(metathis)
library(glue)
library(xaringanExtra)
library(haven)
library(readr)
library(dplyr)
library(knitr)
library(withr)
library(htmltools)
setwd("/Users/riley/STOR 496")
xaringanExtra::use_tile_view()
xaringanExtra::use_share_again()
xaringanExtra::use_broadcast()
xaringanExtra::use_scribble(pen_color = "#a4c4f4", pen_size = 8, eraser_size = 30)
#xaringanExtra::use_animate_all("slide_up")
xaringanExtra::use_fit_screen()
renderthis::to_pdf("WeeklyMeeting1.Rmd")

class: center, middle

Substance Use Disorder

SUD

a treatable mental disorder that affects a person's brain and behavior, leading to their inability to control their use of substances like legal or illegal drugs, alcohol, or medications


Original Data

setwd("/Users/riley/STOR 496")
#replace with your filename
filename <- "defrtdata_original_RH"
sav <- read_sav(paste0("./", filename, ".sav"))
#getwd() # this is the folder it will save into unless you specify otherwise in the path below
write_csv(x = sav, file = paste0("./", filename, ".csv"))
data <- read_csv(paste0("./", filename, ".csv"), show_col_types = F)
merged_data <- data %>%
  group_by(record_id) %>%
  summarize_all(list(~ first(.[!is.na(.)])))
knitr::kable(merged_data[1:2, c(1, 9, 50:ncol(merged_data))], format = "html")

New Data EDA

Missing Image

New Data EDA cont.

Plot Intro

Research Question

1. Are certain SUDs better able to predict craving?

2. Are certain SUDs more likely to lead to a relapse, and does the intensity of craving account for this?

3. How does an individual's number of SUD symptoms predict substance use severity?


Methodology

    1. Clean the data by determining which individuals possess all or mostly NA values and, potentially, impute these values to prevent the loss of observations. Also, adjust for data collection or input error.

    2. Assess the data and determine how many SUD there will be to track.

    3. Determine which individuals possess a single SUD, these individuals will be used as a control when comparing their data against those who are afflicted with mutliple SUD, a common theme in addiction.

    4. Build a model. Start with the intercept only-most simple model-and begin to work towards more relevant seeming models such as linear or logistic regression.

    5. Discuss which tests are relevant for this type of analysis with an n of only ~200 such as ANOVA, stepwise selection, and Cook's Distance.

    6. Attempt a classification model such as LDA, QDA, or ML algorithm.


Methodology cont.

    7. Assess the model's level of performance first by generating a confusion matrix and then by calculating sensitivity and specificity.

    8. Pick the best model and interpret the results in the context of SUD


class: center

Progress

50%

Performing EDA

0%

Clean the Data

0%

Build the Models

0%

Assess Performance

0%

Discuss Results



I won't be able to share my data or images though unfortunately since they could contain sensitive data
gadenbuie commented 9 months ago

I think the root cause is likely the issue you opened in renderthis: https://github.com/jhelvy/renderthis/issues/72

Let's diagnose and work on that problem first.