Skip to content

Commit

Permalink
Fix a bunch of eval false/true inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mine-cetinkaya-rundel committed May 31, 2024
1 parent 88628e8 commit eec2af1
Show file tree
Hide file tree
Showing 24 changed files with 41 additions and 93 deletions.
4 changes: 2 additions & 2 deletions _freeze/html/data-visualization/execute-results/html.json

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions _freeze/html/keras/execute-results/html.json

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions _freeze/html/reticulate/execute-results/html.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions _freeze/html/shiny-python/execute-results/html.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions _freeze/html/shiny/execute-results/html.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions _freeze/html/sparklyr/execute-results/html.json

Large diffs are not rendered by default.

18 changes: 7 additions & 11 deletions html/data-visualization.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ Visualize a stat by changing the default stat of a geom function, `geom_bar(stat
Use `after_stat(name)` syntax to map the stat variable `name` to an aesthetic.

```{r}
#| eval: false
i + stat_density_2d(aes(fill = after_stat(level)), geom = "polygon")
```

Expand Down Expand Up @@ -355,13 +354,12 @@ Override defaults with **scales** package.
To change a mapping, add a new scale.

```{r}
#| eval: false
n <- d + geom_bar(aes(fill = fl))
n + scale_fill_manual(
value = c(),
limits = c(),
breaks = c(),
values = c("skyblue", "royalblue", "blue", "navy"),
limits = c("d", "e", "p", "r"),
breaks =c("d", "e", "p", "r"),
name = "fuel",
labels = c("D", "E", "P", "R")
)
Expand Down Expand Up @@ -484,7 +482,6 @@ s <- ggplot(mpg, aes(fl, fill = drv))
Each position adjustment can be recast as a function with manual `width` and `height` arguments:

```{r}
#| eval: false
s + geom_bar(position = position_dodge(width = 1))
```

Expand All @@ -508,12 +505,11 @@ s + geom_bar(position = position_dodge(width = 1))

- `u + theme()`: Customize aspects of the theme such as axis, legend, panel, and facet properties.

```{r}
#| eval: false
r + ggtitle("Title") + theme(plot.title.postion = "plot")
```{r}
u + labs(title = "Title") + theme(plot.title.position = "plot")
r + theme(panel.background = element_rect(fill = "blue"))
```
u + theme(panel.background = element_rect(fill = "blue"))
```

## Faceting

Expand Down
Binary file modified html/images/logo-ggplot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified html/images/logo-reticulate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified html/images/logo-shiny.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified html/images/logo-sparklyr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified html/images/logo-tensorflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions html/keras.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ The keras R package uses the Python keras library.
You can install all the prerequisites directly from R: <https://tensorflow.rstudio.com/install>.

```{r}
#| eval: false
library(keras)
install_keras()
```
Expand Down
18 changes: 0 additions & 18 deletions html/reticulate.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ Or, if you like, you can convert manually with
Also `iter_next()` and `as_iterator()`.
```{r}
#| eval: false
iterate(iter, print)
```
Expand Down Expand Up @@ -296,8 +294,6 @@ Or, if you like, you can convert manually with
Also `py_set_attr()`, `py_has_attr()`, and `py_list_attributes()`.
```{r}
#| eval: false
py_get_attr(x)
```
Expand All @@ -306,8 +302,6 @@ Or, if you like, you can convert manually with
- `py_help(object)`: Open the documentation page for a Python object.
```{r}
#| eval: false
py_help(sns)
```
Expand All @@ -322,8 +316,6 @@ Or, if you like, you can convert manually with
Also `py_load_object()`.
```{r}
#| eval: false
py_save_objects(x, "x.pickle")
```
Expand Down Expand Up @@ -405,8 +397,6 @@ Then suggest your instance to reticulate.
- `install_python(version, list = FALSE, force = FALSE)`: Download and install Python.
```{r}
#| eval: false
install_python("3.9.16")
```
Expand Down Expand Up @@ -496,8 +486,6 @@ Otherwise, to choose an instance of Python to bind to, reticulate scans the inst
Undo with `Sys.unsetenv()`.
```{r}
#| eval: false
Sys.setenv(RETICULATE_PYTHON = "/usr/local/bin/python")
```
Expand All @@ -507,24 +495,18 @@ Otherwise, to choose an instance of Python to bind to, reticulate scans the inst
- `use_python(python, required = FALSE)`: Suggest a Python binary to use by path.
```{r}
#| eval: false
use_python("usr/local/bin/python")
```
- `use_virtualenv(virtualenv = NULL, required = FALSE)`: Suggest a Python virtualenv
```{r}
#| eval: false
use_virtualenv("~/myenv")
```
- `use_condaenv(condaenv = NULL, conda = "auto", required = FALSE)`: Suggest a conda env to use.
```{r}
#| eval: false
use_condaenv(condaenv = "r-nlp", conda = "/opt/anaconda3/bin/conda")
```
Expand Down
1 change: 1 addition & 0 deletions html/shiny-python.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ execute:
---

```{r}
#| eval: true
#| output: asis
#| echo: false
#| column: margin
Expand Down
33 changes: 3 additions & 30 deletions html/shiny.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ title: "Shiny for R :: Cheatsheet"
description: " "
image-alt: ""
execute:
eval: true
eval: false
output: false
warning: true
---

```{r}
#| eval: true
#| output: asis
#| echo: false
#| column: margin
Expand Down Expand Up @@ -46,8 +47,6 @@ Launch apps stored in a directory with `runApp(<path to directory>)`.
To generate the template, type `shinyApp` and press `Tab` in the RStudio IDE or go to **File \> New Project \> New Directory \> Shiny Application**.

```{r}
#| eval: false
# app.R
library(shiny)
Expand Down Expand Up @@ -188,8 +187,6 @@ Call a reactive value from within the arguments of one of these functions to avo
- `*Input()` functions: Each input function creates a reactive value stored as `input$<inputId>`.

```{r}
#| eval: false
# *Input() example
ui <- fluidPage(
textInput("a","","A")
Expand All @@ -201,8 +198,6 @@ Call a reactive value from within the arguments of one of these functions to avo
`reactiveValues(...)`: Creates a list of reactive values whose values you can set.
```{r}
#| eval: false
# reactiveVal example
server <- function(input,output){
rv <- reactiveValues()
Expand All @@ -225,8 +220,6 @@ Call a reactive value from within the arguments of one of these functions to avo
Call the expression with function syntax, e.g. `re()`.
```{r}
#| eval: false
library(shiny)
ui <- fluidPage(
Expand All @@ -252,8 +245,6 @@ Call a reactive value from within the arguments of one of these functions to avo
- `eventReactive(eventExpr, valueExpr, event.env, event.quoted, value.env, value.quoted, ..., label, domain, ignoreNULL, ignoreInit)`: Creates reactive expression with code in 2nd argument that only invalidates when reactive values in 1st argument change.
```{r}
#| eval: false
library(shiny)
ui <- fluidPage(
Expand All @@ -279,8 +270,6 @@ Call a reactive value from within the arguments of one of these functions to avo
Save the results to `output$<outputId>`.
```{r}
#| eval: false
library(shiny)
ui <- fluidPage(
Expand All @@ -306,8 +295,6 @@ Call a reactive value from within the arguments of one of these functions to avo
Alternative to ``` observe``() ```.
```{r}
#| eval: false
library(shiny)
ui <- fluidPage(textInput("a","","A"), actionButton("go","Go"))
Expand All @@ -327,8 +314,6 @@ Call a reactive value from within the arguments of one of these functions to avo
Returns a **non-reactive** copy of the results.
```{r}
#| eval: false
library(shiny)
ui <- fluidPage(
Expand All @@ -353,7 +338,6 @@ An app's UI is an HTML document.
Use Shiny's functions to assemble this HTML with R.
```{r}
#| eval: false
fluidPage(
textInput("a","")
)
Expand All @@ -380,8 +364,6 @@ The most common tags have wrapper functions.
You do not need to prefix their names with `tags$`.

```{r}
#| eval: false
ui <- fluidPage(
h1("Header 1"), # <h1>Header 1</h1>
hr(), # <hr>
Expand All @@ -401,8 +383,6 @@ To include a CSS file, use `includeCSS()`, or
2. Link to it with:

```{r}
#| eval: false
tags$head(
tags$link(
rel = "stylesheet",
Expand All @@ -419,8 +399,6 @@ To include JavaScript, use `includeScript()`, or
2. Link to it with:
```{r}
#| eval: false
tags$head(tags$script(src = "<file name>"))
```
Expand All @@ -431,8 +409,6 @@ To include an image:
2. Link to it with:
```{r}
#| eval: false
img(src = "<file name>")
```
Expand Down Expand Up @@ -497,8 +473,6 @@ Also dynamically update nav containers with `nav_select()`, `nav_insert()`, `nav
Use the **bslib** package to add existing themes to your Shiny app ui, or make your own.
```{r}
#| eval: false
library(bslib)
ui <- fluidPage(
theme = bs_theme(
Expand All @@ -513,8 +487,6 @@ ui <- fluidPage(
Build your own theme by customizing individual arguments.

```{r}
#| eval: false
bs_theme(
bg = "#558AC5",
fg = "#F9B02D",
Expand All @@ -536,6 +508,7 @@ Updated: `r format(Sys.Date(), "%Y-%m")`.

```{r}
#| output: true
#| eval: true
packageVersion("shiny")
```
Expand Down
1 change: 1 addition & 0 deletions html/sparklyr.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ execute:
---

```{r}
#| eval: true
#| output: asis
#| echo: false
#| column: margin
Expand Down
Loading

0 comments on commit eec2af1

Please sign in to comment.