vec2assign_str | R Documentation |
Function to convert a vector to a string formated like 'c("elt1", "elt2", ...)' so it can be used to assign a variable with the content of the vector without having to rerun the code used to make it.
vec2assign_str(vec)
vec |
a vector object |
a character vector of length 1
vec <- grep("^A", names(islands), value = TRUE)
cat(vec2assign_str(vec))
# then copy-paste from console to the assignment
# OR save it in clipboard with the clipr package and then paste it to the assignment
# clipr::write_clip(vec2assign_str(vec))
islands_startingWithA <- c("Africa", "Antarctica", "Asia", "Australia", "Axel Heiberg")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.