Learn R Programming

mark (version 0.8.1)

print_c: Print as c

Description

Prints a vector to paste into an R script

Usage

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

Value

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

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.

Examples

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

Run the code above in your browser using DataLab