kbodwin / demoR

(this package has been replaced by "flair")
https://kbodwin.github.io/flair/index.html
Other
47 stars 7 forks source link

Bug Report: Error in code_from_editor(sources, label) #14

Open JiaxiangBU opened 5 years ago

JiaxiangBU commented 5 years ago

I run an example from the vignette in the README. However, I get errors.

Here is a reproducible minimal example.

```{r, include = FALSE, demo = "how_to_pipe"}

iris %>%
  group_by(Species) %>%
  summarize(mean(Sepal.Length))

demo_chunk("how_to_pipe") %>% hlt_fixed("%>%")

Here is the error message.

```r
Error in code_from_editor(sources, label) : Error: No chunk found with label 'how_to_pipe'
9.
stop(paste0("Error: No chunk found with label '", label, "'"))
8.
code_from_editor(sources, label)
7.
stri_trim_both(string)
6.
str_trim(.code_string)
5.
demo_code(code_from_editor(sources, label))
4.
demo_chunk("how_to_pipe")
3.
eval(lhs, parent, parent)
2.
eval(lhs, parent, parent)
1.
demo_chunk("how_to_pipe") %>% hlt_fixed("%>%")

For better understanding my problem, I produce a screenshot.

image

I worry about the OS system, maybe Win7 does not fit this package?

Here is my session info.

"si"
#> [1] "si"

Created on 2019-08-09 by the reprex package (v0.2.1)

Session info ``` r devtools::session_info() #> - Session info ---------------------------------------------------------- #> setting value #> version R version 3.5.2 (2018-12-20) #> os Windows 7 x64 SP 1 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate Chinese (Simplified)_People's Republic of China.936 #> ctype Chinese (Simplified)_People's Republic of China.936 #> tz Asia/Taipei #> date 2019-08-09 #> #> - Packages -------------------------------------------------------------- #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.5.3) #> backports 1.1.4 2019-04-10 [1] CRAN (R 3.5.3) #> callr 3.2.0 2019-03-15 [1] CRAN (R 3.5.3) #> cli 1.1.0 2019-03-19 [1] CRAN (R 3.5.3) #> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.2) #> desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.2) #> devtools 2.0.2 2019-04-08 [1] CRAN (R 3.5.3) #> digest 0.6.19 2019-05-20 [1] CRAN (R 3.5.3) #> evaluate 0.14 2019-05-28 [1] CRAN (R 3.5.3) #> fs 1.3.1 2019-05-06 [1] CRAN (R 3.5.3) #> glue 1.3.1 2019-03-12 [1] CRAN (R 3.5.3) #> highr 0.8 2019-03-20 [1] CRAN (R 3.5.3) #> htmltools 0.3.6 2017-04-28 [1] CRAN (R 3.5.2) #> knitr 1.23 2019-05-18 [1] CRAN (R 3.5.3) #> magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.2) #> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.2) #> pkgbuild 1.0.3 2019-03-20 [1] CRAN (R 3.5.3) #> pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.2) #> prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.2) #> processx 3.4.1 2019-07-18 [1] CRAN (R 3.5.3) #> ps 1.3.0 2018-12-21 [1] CRAN (R 3.5.2) #> R6 2.4.0 2019-02-14 [1] CRAN (R 3.5.3) #> Rcpp 1.0.2 2019-07-25 [1] CRAN (R 3.5.3) #> remotes 2.1.0 2019-06-24 [1] CRAN (R 3.5.3) #> rlang 0.4.0 2019-06-25 [1] CRAN (R 3.5.3) #> rmarkdown 1.13 2019-05-22 [1] CRAN (R 3.5.3) #> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.2) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.3) #> stringi 1.4.3 2019-03-12 [1] CRAN (R 3.5.3) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 3.5.3) #> testthat 2.1.1 2019-04-23 [1] CRAN (R 3.5.3) #> usethis 1.5.0 2019-04-07 [1] CRAN (R 3.5.3) #> withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.2) #> xfun 0.8 2019-06-25 [1] CRAN (R 3.5.3) #> yaml 2.2.0 2018-07-25 [1] CRAN (R 3.5.2) #> #> [1] C:/Program Files/R/R-3.5.2/library ```
kbodwin commented 5 years ago

Yikes, this is an error in the documentation. Thank you for bringing it to our attention!

"how_to_pipe" should actually be a chunk name:


```{r how_to_pipe, include = FALSE}

iris %>%
  group_by(Species) %>%
  summarize(mean(Sepal.Length))

demo_chunk("how_to_pipe") %>% hlt_fixed("%>%")


Sorry for the confusion!