write_to_clipboard: Write R data to clipboard

Description Usage Arguments Value Examples

View source: R/write_to_clipboard.R

Description

A function to easily copy data out of R into a spreadsheet. This should not be used within a reproducible work flow, instead it should only be used on an ad-hoc basis (note: I'm not aware of the original author of this function, it was taken directly from a stack overflow answer)

Usage

1

Arguments

x

a data.frame to be copied to clipboard

row.names

a logical indicating if row names should be included

col.names

a logical indicating if column names should be included

...

other read.table options

Value

data.frame copied to clipboard

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# set dummy data

set.seed(2)

data = data.frame(date = sample(seq(as.Date("2017-03-01"), as.Date("2017-08-01"), 1), 20, replace = TRUE),
                  sex = sample(c("Female", "Male"), 20, replace = TRUE))

# apply function to write data to clipboard

write_to_clipboard(data)

# now paste data into a spreadsheet (i.e. open a spreadsheet and press ctrl + v)

DanielGardiner/EpiFunc documentation built on July 25, 2019, 10:53 p.m.