Skip to content

How do I provide string values to params which would otherwise be parsed as numbers? #12736

@Mosk915

Description

@Mosk915

Bug description

I have a quarto document that takes parameters. One of the parameters is a character string but only contains digits. If the param being passed ends in an 8 or a 9, it converts the character string to a numeric. When it ends in any other digit, it keeps it as a character.

Steps to reproduce

---
title: "Params"
format: html
params:
  number: null
---

```{r}
print(params$number)
```
library(quarto)

quarto_render("param.qmd", execute_params = list(number = "029"))

Actual behavior

Any param that is a character string containing only digits will be converted to a numeric if it ends in 8 or 9.

Expected behavior

Character strings should not be converted to numerics ever.

Your environment

IDE: Posit Workbench 2023.12.1+402.pro1
OS: Ubuntu 20.04

Quarto check output

$ quarto check
Quarto 1.6.42
[✓] Checking environment information...
      Quarto cache location: /home/user1/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.6.42
      Path: /opt/quarto/1.6.42/bin

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

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/local/bin
      Version: 2021

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.9
      Path: /opt/python/3.12.9/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.3.3
      Path: /opt/R/4.3.3/lib/R
      LibPaths:
        - /home/user1/R/x86_64-pc-linux-gnu-library/4.3
        - /opt/R/4.3.3/lib/R/library
        - /pkglibrary/R/4.3
      knitr: 1.47
      rmarkdown: 2.27

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    supporta request for support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions