toclipboard: Copy Data to Clipboard

View source: R/toclipboard.R

toclipboardR Documentation

Copy Data to Clipboard

Description

A data frame of variable is written to the clipboard, allowing easy pasting to MS Excel and Open/Libre Office Calc. This function is a wrapper to write.table with pre-specified options for plug-and-play usage. Most options of write.table are also supported by toclipboard. Note: The current version of toclipboard only supports Windows systems; the function will not run under Linux or Mac OS.

Usage

toclipboard(data,
            sep = "\t", quote = FALSE,
            eol = "\n",  na = "NA",
            dec = ".", row.names = FALSE,
            col.names = TRUE,
			clipwarning = FALSE)

Arguments

data

The first argument should be the data frame or variable that is to be written to the clipboard. Data frames are copied with column names but without row names and columns are separated by tabs. This behavior can be customized with the following optional arguments (passed to write.table).

sep

Delimiter string.

quote

Put quotes around strings?

eol

End-of-line character.

na

How should NA-values be written?

dec

Decimal separator.

row.names

Should row names be written?

col.names

Should column names be written?

clipwarning

Determine if warnings should overwrite clipboard content (especially in case of buffer overflow when attempting to copy large datasets to the clipboard.

Author(s)

Roland Pfister

See Also

write.table

Examples

## Build data frame
var1 <- c(1:9)
var2 <- c(1,1,1,2,2,2,3,3,3)
tmpdata <- data.frame(cbind(var1,var2))

## Write data frame to clipboard
toclipboard(tmpdata)

## -> The data frame can now be pasted
## into any other application.

schoRsch documentation built on Nov. 2, 2022, 1:06 a.m.