EvaMaeRey / flipbookr

Presenting code step-by-step and side-by-side with its output
https://evamaerey.github.io/flipbookr/
Other
198 stars 20 forks source link

Cannot reuse object in flipbook #60

Closed Ecosantos closed 1 month ago

Ecosantos commented 1 month ago

I cannot create an object inside flipbook and use it later. Am I wrong?

Consider the minimum reproducible code below. It just finishes the execution without knitting the document. --- title: "A minimal flipbook" subtitle: "With flipbookr and xaringan" author: "You!" output: xaringan::moon_reader: lib_dir: libs css: [default, hygge, ninjutsu] nature: ratio: 16:9 highlightStyle: github highlightLines: true countIncrementalSlides: false ---

```{r, include = F} # This is the recommended set up for flipbooks # you might think about setting cache to TRUE as you gain practice --- building flipbooks from scratch can be time consuming knitr::opts_chunk$set(fig.width = 6, message = FALSE, warning = FALSE, comment = "", cache = F) library(flipbookr) ```

```{r} TESTE<-1 ```

`r chunk_reveal("my_cars")`

```{r my_cars, include = FALSE} TESTE ```

EvaMaeRey commented 1 month ago

I think your question is, should you be able to look at TESTE in the 'my_cars' code chunk, and you should be able to.

Here's output,

https://evamaerey.github.io/mytidytuesday/2024-10-20-flipbookr-outside-object/flipbookr-outside-object.html#2

from source:

https://github.com/evamaerey/mytidytuesday/blob/master/2024-10-20-flipbookr-outside-object/flipbookr-outside-object.Rmd

Is the output what you are trying to do?

Ecosantos commented 1 month ago

Hi @EvaMaeRey , thank you very much for your time.

This is exactly the output I expected but I'm still facing issues even copying the code you shared.

BTW, I made some twitches to finish the slide I was working on with success but I'll be happy if I can fix this problem as well.

This is the issue Rstudio report followed by my session info in case you can spot the problem.

processing file: TESTE.Rmd |........................................... | 83% Joining with by = join_by(line) Joining with by = join_by(line) Error in dplyr::mutate(): ℹ In argument: highlight = ifelse(line %in% which_highlight_frame, "#<<", ""). Caused by error in which_show[[i]]: ! índice fora dos limites Backtrace:

  1. flipbookr::chunk_reveal("my_cars")
  2. flipbookr:::parsed_return_partial_code_sequence(...)
    1. flipbookr:::shown_lines_calc_highlight(...)

Quitting from lines 27-30 (TESTE.Rmd) Execução interrompida

sessionInfo()

sessionInfo() R version 4.4.1 (2024-06-14 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale: [1] LC_COLLATE=Portuguese_Brazil.utf8 [2] LC_CTYPE=C
[3] LC_MONETARY=Portuguese_Brazil.utf8 [4] LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.utf8

time zone: America/Sao_Paulo tzcode source: internal

attached base packages: [1] stats graphics grDevices utils datasets [6] methods base

loaded via a namespace (and not attached): [1] compiler_4.4.1 fastmap_1.2.0 cli_3.6.3
[4] htmltools_0.5.8.1 tools_4.4.1 rstudioapi_0.16.0 [7] xaringan_0.30 yaml_2.3.10 rmarkdown_2.27
[10] knitr_1.48 xfun_0.46 digest_0.6.36
[13] rlang_1.1.4 evaluate_0.24.0

EvaMaeRey commented 1 month ago

Are you using the development version of flipbookr or CRAN?

Ecosantos commented 1 month ago

CRAN

packageStatus()$inst%>%select(Package,Version,Status,Built)%>%filter(Package=="flipbookr") Package Version Status Built flipbookr 0.1.0 ok 4.4.1

Ecosantos commented 1 month ago

Now it is working. I just updated the package and the dependencies!

Thank you very much for your time!

Btw, I'm really enjoying you great work with flipbook and teaching material for data visualization.

remotes::install_github("EvaMaeRey/flipbookr") Using GitHub PAT from the git credential store. Downloading GitHub repo EvaMaeRey/flipbookr@HEAD These packages have more recent versions available. It is recommended to update all of them. Which would you like to update?

1: All
2: CRAN packages only
3: None
4: xfun (0.46 -> 0.48 ) [CRAN] 5: evaluate (0.24.0 -> 1.0.1 ) [CRAN] 6: digest (0.6.36 -> 0.6.37) [CRAN] 7: glue (1.7.0 -> 1.8.0 ) [CRAN] 8: jsonlite (1.8.8 -> 1.8.9 ) [CRAN] 9: tinytex (0.52 -> 0.53 ) [CRAN] 10: cpp11 (0.4.7 -> 0.5.0 ) [CRAN] 11: rmarkdown (2.27 -> 2.28 ) [CRAN]

EvaMaeRey commented 1 month ago

Good to hear and thanks for the feedback on the projects!