Prints a vector to paste into an R script
Usage
print_c(x = read_clipboard(), sorted = TRUE, null = TRUE)
Details
This sorts (if set) and provides unique values for each element in x
and
prints then as a call to c
. This can be useful for copying data that you
want to save as a vector in an R script.
The result is both called in cat()
as well as copied to the clipboard.
Examples
print_c(1:10)
#> c(
#> 1,
#> 2,
#> 3,
#> 4,
#> 5,
#> 6,
#> 7,
#> 8,
#> 9,
#> 10,
#> NULL
#> )
print_c(letters[1:3])
#> c(
#> "a",
#> "b",
#> "c",
#> NULL
#> )
print_c(month.abb)
#> c(
#> "Apr",
#> "Aug",
#> "Dec",
#> "Feb",
#> "Jan",
#> "Jul",
#> "Jun",
#> "Mar",
#> "May",
#> "Nov",
#> "Oct",
#> "Sep",
#> NULL
#> )