print_c: Print as c

View source: R/strings.R

print_cR Documentation

Print as c

Description

Prints a vector to paste into an R script

Usage

print_c(x = read_clipboard(), sorted = TRUE, null = TRUE)

Arguments

x

A vector (defaults to reading the clipboard)

sorted

If TRUE (default) applies sort() to x

null

If TRUE (default) adds NULL at the end of the c() print

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.

Value

Invisibly, as a character vector, the object printed to the console

Examples

print_c(1:10)
print_c(letters[1:3])
print_c(month.abb)


mark documentation built on Oct. 23, 2023, 9:06 a.m.