Skip to content

Instantly share code, notes, and snippets.

@cannin
Last active August 29, 2015 14:03
Show Gist options
  • Save cannin/adea2b2c9d2ed94886dc to your computer and use it in GitHub Desktop.
Save cannin/adea2b2c9d2ed94886dc to your computer and use it in GitHub Desktop.
Convert R vector into a call object and then convert the "call" object to a character string; this was useful for converting a vector back into code when generating knitr reports using brew
# Convert R vector into a call object and then convert the "call" object to a character string
# This was useful for converting a vector back into code when generating knitr reports using brew
tmp <- c("A", "B", "C")
deparse(do.call(call, as.list(c("c", tmp))))
# [1] "c(\"A\", \"B\", \"C\")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment