Skip to contents

[Maturing]

vector_to_c() put a vector into the c() function.

This function is useful when you want to assign values in a vector while programming in R.

Usage

vector_to_c(x, quote = TRUE, clipboard = TRUE)

Arguments

x

An atomic vector.

quote

A logical flag indicating if the values should be wrapped in double quotes (Default: TRUE).

clipboard

A logical flag indicating if the output should be copied to the clipboard (Default: TRUE).

Value

A character string with all values from x inside the c() function.

Examples

vector_to_c(letters[1:5], clipboard = FALSE)
#> c("a", "b", "c", "d", "e")
#> [1] "c(\"a\", \"b\", \"c\", \"d\", \"e\")"
#> c("a", "b", "c", "d", "e") # Expected

vector_to_c(1:5, quote = FALSE, clipboard = FALSE)
#> c(1, 2, 3, 4, 5)
#> [1] "c(1, 2, 3, 4, 5)"
#> c(1, 2, 3, 4, 5) # Expected