We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
paste()
glue()
This
library(glue) vowels <- c("a", "e", "i", "o", "u") glue("The vowels are: {paste(vowels, collapse = ", ")}.")
produces:
The vowels are: a. The vowels are: e. The vowels are: i. The vowels are: o. The vowels are: u.
One expects the output to be the same as:
library(glue) vowels <- c("a", "e", "i", "o", "u") vowels_pasted <- paste(vowels, collapse = ", ") glue("The vowels are: {vowels_pasted}.")
The vowels are: a, e, i, o, u.
Session info:
R version 4.4.2 (2024-10-31) Platform: aarch64-apple-darwin20 Running under: macOS Sequoia 15.1.1 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0 locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 time zone: America/New_York tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] glue_1.8.0 loaded via a namespace (and not attached): [1] compiler_4.4.2 cli_3.6.3 tools_4.4.2 rstudioapi_0.17.0 [5] crayon_1.5.3 rlang_1.1.4
The text was updated successfully, but these errors were encountered:
I'd guess this is simply because you've used double quotes twice.
Switching one of the double quotes to single quotes gives the expected output.
library(glue) vowels <- c("a", "e", "i", "o", "u") glue("The vowels are: {paste(vowels, collapse = ', ')}.") #> The vowels are: a, e, i, o, u.
Created on 2024-12-09 with reprex v2.1.1
Sorry, something went wrong.
That's right.
No branches or pull requests
This
produces:
One expects the output to be the same as:
Session info:
The text was updated successfully, but these errors were encountered: