Skip to content

Commit

Permalink
Merge pull request #86 from rstats-wtf/callouts
Browse files Browse the repository at this point in the history
  • Loading branch information
edavidaja authored Jun 11, 2023
2 parents 6eaff9b + 4fc0706 commit 50e56e5
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 43 deletions.
26 changes: 13 additions & 13 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ book:
- Shannon Pileggi
- E. David Aja
chapters:
- index.Rmd
- index.qmd
- part: "A holistic workflow"
chapters:
- source-and-blank-slates.Rmd
- projects.Rmd
- practice-safe-paths.Rmd
- naming-files.Rmd
- api-for-an-analysis.Rmd
- source-and-blank-slates.qmd
- projects.qmd
- practice-safe-paths.qmd
- naming-files.qmd
- api-for-an-analysis.qmd
- part: "Personal R Administration"
chapters:
- get-to-know-your-r-installation.Rmd
- get-to-know-your-r-installation.qmd
- r-startup.qmd
- maintaining-r.Rmd
- install-single-package.Rmd
- maintaining-r.qmd
- install-single-package.qmd
- part: "All is Fail"
chapters:
- debugging-r.Rmd
- read-source.Rmd
- reprexing.Rmd
- sessioninfo.Rmd
- debugging-r.qmd
- read-source.qmd
- reprexing.qmd
- sessioninfo.qmd

bibliography: [book.bib, packages.bib]
link-citations: true
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions debugging-r.Rmd → debugging-r.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ When `recover()` is called it prints a list of the current calls, with a prompt
select which you want to browse in. Then a debugging session is started at that
location.

```{block type="rmdinfo"}
::: {.callout-note}
[Try activity 1](https://raw.githubusercontent.com/jimhester/wtf-debugging/master/01_debugging_spartan.R) `usethis::use_course("rstd.io/wtf-debugging")`
[Try activity 2](https://raw.githubusercontent.com/jimhester/wtf-debugging/master/02_debugging_spartan.R) `usethis::use_course("rstd.io/wtf-debugging")`

to practice debugging errors using the tools described
```
:::

### `debug()`

Expand Down Expand Up @@ -214,11 +214,11 @@ expressions at other points in the function body. To determine the number of
the expression to insert convert the body of the function to a list. e.g.
`as.list(body(fun))`.

```{block type="rmdinfo"}
::: {.callout-note}
[Try activity 3](https://raw.githubusercontent.com/jimhester/wtf-debugging/master/03_debugging_spartan.R) `usethis::use_course("rstd.io/wtf-debugging")`

to explore using `trace()` with `at`.
```
:::

## Debugging in R Markdown documents

Expand Down Expand Up @@ -248,11 +248,11 @@ Then knit the file on the R console with `knitr::knit()` or
`rmarkdown::render()`. The traceback will contain all of the knitr calls as
well, so you will need to look near the end to find the calls in your code.

```{block type = "rmdwarning"}
::: {.callout-warning}
Note you _cannot_ use the 'Knit' button in RStudio when trying to debug
R Markdown documents in any case. The 'Knit' button opens a separate R process,
so there is no way to use an interactive debugger in that case.
```
:::

### Resources

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions install-single-package.Rmd → install-single-package.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ library(beyonce, lib.loc = tmp_lib)
unlink(tmp_lib, recursive = TRUE)
```

```{block type="rmdinfo"}
::: {.callout-note}
[Try the activity](https://raw.githubusercontent.com/jimhester/wtf-source-package/master/01_source-package_spartan.R): `usethis::use_course("rstd.io/wtf-source-package")`

To practice installing various types of source packages.
```
:::
12 changes: 6 additions & 6 deletions maintaining-r.Rmd → maintaining-r.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ In addition if the given package is _not_ already installed it will install it.

First if unsure what version -> [CRAN page](https://cran.r-project.org/web/packages/devtools/index.html) -> [pkgname archive](https://cran.r-project.org/src/contrib/Archive/devtools/)

```r
```{.r}
devtools::install_version("devtools", "1.13.3")
```

Expand All @@ -47,12 +47,12 @@ packages you are currently using.
For 'minor' version changes, the 'y' in 'x.y.z' the package interface _can_
change, so packages need to be re-installed.

```{block type="rmdwarning"}
::: {.callout-warning}
You may see some suggestions that you can just copy your packages even when the
'minor' version changes. **DO NOT DO THIS**. While it may work some (even most)
of the time, R-core does not guarantee compatibility between these versions and
things could break (even break silently).
```
:::

I suggest you keep the packages R comes with (base and recommended)
packages separate from the rest of your packages. This makes it easy to
Expand All @@ -70,16 +70,16 @@ automatically expanded to the major and minor version of R, so with R 3.5.1
this path becomes `~/R/library/3.5`. See [Renviron](#renviron) for how
to edit your `.Renviron` file.

```{block type = "rmdwarning"}
::: {.callout-warning}
Paths in `R_LIBS_USER` are only used if the directories they specify actually
exist. So in addition to adding `R_LIBS_USER` to your `.Renviron` you need to
create the directory as well.
```
:::

Once this is setup, the process for transferring your package library becomes.
(assumes `R_LIBS_USER` is set to `~/Library/R/3.5/library`).

```r
```{.r}
# Install new version of R (lets say 3.5.0 in this example)
# Create a new directory for the version of R
Expand Down
File renamed without changes.
7 changes: 3 additions & 4 deletions packages.bib
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@ @Manual{R-base
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2022},
year = {2023},
url = {https://www.R-project.org/},
}

@Manual{R-knitr,
title = {knitr: A General-Purpose Package for Dynamic Report Generation in R},
author = {Yihui Xie},
year = {2023},
note = {R package version 1.42},
note = {R package version 1.43},
url = {https://yihui.org/knitr/},
}

@Manual{R-rmarkdown,
title = {rmarkdown: Dynamic Documents for R},
author = {JJ Allaire and Yihui Xie and Christophe Dervieux and Jonathan McPherson and Javier Luraschi and Kevin Ushey and Aron Atkins and Hadley Wickham and Joe Cheng and Winston Chang and Richard Iannone},
year = {2023},
note = {R package version 2.21},
url = {https://CRAN.R-project.org/package=rmarkdown},
note = {https://github.com/rstudio/rmarkdown},
}

@Book{knitr2015,
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions read-source.Rmd → read-source.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ as stats, graphics, utils and others ([`src/library/*`](https://github.com/wch/r
the documentation included in R including Writing R extensions, R internals and
R admin guides ([`doc/manual`](https://github.com/wch/r-source/tree/trunk/doc/manual)).

```{block type="rmdinfo"}
::: {.callout-note}
[Try the activity](https://raw.githubusercontent.com/jimhester/wtf-read-source/master/01_read-source_spartan.R) `usethis::use_course("rstd.io/wtf-read-source")`

to search the R source for code and documentation.
```
:::

## Where things exist in CRAN packages

Expand Down Expand Up @@ -59,8 +59,8 @@ language the compiled code is written in.

Long-form documentation in the form of vignettes are stored in `vignettes/`.

```{block type="rmdinfo"}
::: {.callout-note}
[Try the activity](https://raw.githubusercontent.com/jimhester/wtf-read-source/master/02_read-source_spartan.R) `usethis::use_course("rstd.io/wtf-read-source")`

to search and find source code and documentation in CRAN packages.
```
:::
5 changes: 0 additions & 5 deletions references.Rmd

This file was deleted.

7 changes: 4 additions & 3 deletions references.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# References {.unnumbered}
# (PART) Backmatter {-}

::: {#refs}
:::
`r if (knitr:::is_html_output()) '
# References {-}
'`
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 50e56e5

Please sign in to comment.