Skip to content

quarto_render changes the class of vectors containing NA values #168

Open
@debdagybra

Description

@debdagybra

quarto_render() changes NA of numeric vectors to character ".na.real"

Similar to #124


library(quarto)
quarto_render("test.qmd",
              execute_params = list(
                test_vec = c(1, NA, 2.5, -6.33, NaN, Inf)
              ))

Content of "test.qmd"

---
title: "test"
format: html
params:
  test_vec: "test_vec"
---

### With params:  
class: `r class(params$test_vec)`  
values: `r params$test_vec`  
is.na: `r is.na(params$test_vec)`  

```{r setup, include = FALSE}
test_vec <- c(1, NA, 2.5, -6.33, NaN, Inf)
```

### Created within qmd file:  
class: `r class(test_vec)`  
values: `r test_vec`  
is.na: `r is.na(test_vec)`  

Returns:

With params:

class: character
values: 1, .na.real, 2.5, -6.33, NA, NA
is.na: FALSE, FALSE, FALSE, FALSE, TRUE, TRUE

Created within qmd file:

class: numeric
values: 1, NA, 2.5, -6.33, NaN,
is.na: FALSE, TRUE, FALSE, FALSE, TRUE, FALSE


This behaviour occurs also to columns of dataframes and tibbles.


Windows 11
rstudio version: 2023.12.1+402
Quarto 1.5.26
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.1.11: OK
Dart Sass version 1.70.0: OK
Deno version 1.41.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.5.26
Path: C:\Users\xxxxxx\AppData\Local\Programs\Quarto\bin
CodePage: 1252

[>] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)

[>] Checking LaTeX....................OK
Tex: (not detected)

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....(None)
Unable to locate an installed version of Python 3.
Install Python 3 from https://www.python.org/downloads/

[>] Checking R installation...........OK
Version: 4.3.3
Path: C:/PROGRA1/R/R-431.3
LibPaths:
- C:/Users/xxxxxx/AppData/Local/R/win-library/4.3
- C:/Program Files/R/R-4.3.3/library
knitr: 1.45
rmarkdown: 2.26

[>] Checking Knitr engine render......OK

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions