mirror of https://github.com/msberends/AMR.git
72 lines
2.8 KiB
R
72 lines
2.8 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/clipboard.R
|
|
\name{clipboard}
|
|
\alias{clipboard}
|
|
\alias{clipboard_import}
|
|
\alias{clipboard_export}
|
|
\title{Import/export from clipboard}
|
|
\usage{
|
|
clipboard_import(sep = "\\t", header = TRUE, dec = ".", na = c("", "NA",
|
|
"NULL"), startrow = 1, as_vector = TRUE)
|
|
|
|
clipboard_export(x, sep = "\\t", dec = ".", na = "", header = TRUE,
|
|
info = TRUE)
|
|
}
|
|
\arguments{
|
|
\item{sep}{the field separator character. Values on each line of the
|
|
file are separated by this character. If \code{sep = ""} (the
|
|
default for \code{read.table}) the separator is \sQuote{white space},
|
|
that is one or more spaces, tabs, newlines or carriage returns.}
|
|
|
|
\item{header}{a logical value indicating whether the file contains the
|
|
names of the variables as its first line. If missing, the value is
|
|
determined from the file format: \code{header} is set to \code{TRUE}
|
|
if and only if the first row contains one fewer field than the
|
|
number of columns.}
|
|
|
|
\item{dec}{the character used in the file for decimal points.}
|
|
|
|
\item{na}{the string to use for missing values in the data.}
|
|
|
|
\item{startrow}{\emph{n}th row to start importing from. When \code{header = TRUE}, the import will start on row \code{startrow} \emph{below} the header.}
|
|
|
|
\item{as_vector}{a logical value indicating whether data consisting of only one column should be imported as vector using \code{\link[dplyr]{pull}}. This will strip off the header.}
|
|
|
|
\item{x}{the object to be written, preferably a matrix or data frame.
|
|
If not, it is attempted to coerce \code{x} to a data frame.}
|
|
|
|
\item{info}{print info about copying}
|
|
}
|
|
\value{
|
|
data.frame
|
|
}
|
|
\description{
|
|
These are helper functions around \code{\link{read.table}} and \code{\link{write.table}} to import from and export to clipboard with support for Windows, Linux and macOS. The data will be read and written as tab-separated by default, which makes it possible to copy and paste from other software like Excel and SPSS without further transformation. See Details for an example.
|
|
}
|
|
\details{
|
|
For \code{clipboard_export()}, the reserved clipboard size for exporting will be set to 125\% of the object size of \code{x}. This way, it is possible to export data with thousands of rows as the only limit will be your systems RAM.
|
|
|
|
Example for copying from Excel:
|
|
\if{html}{
|
|
\out{<div style="text-align: left">}\figure{Excel_copy.png}\out{</div>}
|
|
}
|
|
\if{latex}{
|
|
\out{\begin{left}}\figure{Excel_copy.png}\out{\end{left}}
|
|
}
|
|
\cr
|
|
And pasting in R: \cr \cr
|
|
\code{> data <- clipboard_import()} \cr
|
|
\code{> data} \cr
|
|
\if{html}{
|
|
\out{<div style="text-align: left">}\figure{Excel_paste.png}\out{</div>}
|
|
}
|
|
\if{latex}{
|
|
\out{\begin{left}}\figure{Excel_paste.png}\out{\end{left}}
|
|
}
|
|
}
|
|
\keyword{clipboard}
|
|
\keyword{clipboard_export}
|
|
\keyword{clipboard_import}
|
|
\keyword{export}
|
|
\keyword{import}
|