diff --git a/DESCRIPTION b/DESCRIPTION index bb341f5..4b0ca48 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: clipr Type: Package Title: Read and Write from the System Clipboard -Version: 0.1.1.9000 +Version: 0.2.0 Authors@R: c( person("Matthew", "Lincoln", email = "matthew.d.lincoln@gmail.com", role = c("aut", "cre")), person("Louis", "Maddox", role = "ctb")) diff --git a/NEWS.md b/NEWS.md index 93969ee..c54509c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,23 @@ +## clipr 0.2.0 + +- Several changes to `write_clip` + - The separator to be used when writing a character vector can now be + explicitly declared using `breaks`. `breaks=NULL` will default to + system-specific line breaks for both vectors and tables. + - `write_clip` will default to formatting data.frames and matricies with + `write.table`, allowing easy pasting of tabular objects into programs like + Excel. Option `object_type="auto"` will check the object type to decide on the + correct formatting, or the user may explicitly state `object_type="table"` or + `object_type="character"`. + - clipr will default to sane system-specific options for `write.table()`, + however you may pass any custom desired options via `write_clip` + - `return_new=TRUE` (the default behavior) will return the formatted + character string that was passed to the system clipboard, while + `write_clip(return_new=FALSE)` will return the original object. + +- Introduces `clear_clip`, a wrapper function for `write_clip("")` for easy +clearing of the system clipboard. + ## clipr 0.1.1 - Bug fix that removes the explicit test for "Linux" in favor of a check for diff --git a/R/clipboard.R b/R/clipboard.R index d92fb55..8c5d771 100644 --- a/R/clipboard.R +++ b/R/clipboard.R @@ -5,6 +5,12 @@ #' @return A character vector with the contents of the clipboard. If the system #' clipboard is empty, returns NULL #' +#' @note \code{read_clip} will not try to guess at how to parse copied text. If +#' you are copying tabular data, it is suggested that you use +#' \code{\link[readr]{read_delim}} or one of its sibling functions from the +#' readr package (\url{https://cran.r-project.org/package=readr}) to coax the +#' text into a data frame. +#' #' @examples #' clip_text <- read_clip() #' diff --git a/cran-comments.md b/cran-comments.md index 9cdf189..93fa81d 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,10 +1,3 @@ -## Resubmission -This is a resubmission. In this version I have: - -* Removed the check for a "Linux" system. Instead, if system != "Darwin" or "Windows", will assume a Unix-like system - -* Reimplemented the check for 'xclip' and/or 'xsel'. The following error will still be thrown if neither program is installed: `Error: Clipboard on Unix-like systems requires 'xclip' (recommended) or 'xsel'.` - ## Test environments * local OS X install, R 3.2.2 * local ubuntu 14.04, R 3.2.2 diff --git a/man/read_clip.Rd b/man/read_clip.Rd index 4f889cc..e422668 100644 --- a/man/read_clip.Rd +++ b/man/read_clip.Rd @@ -13,6 +13,13 @@ A character vector with the contents of the clipboard. If the system \description{ Read the contents of the system clipboard into a character vector. } +\note{ +\code{read_clip} will not try to guess at how to parse copied text. If + you are copying tabular data, it is suggested that you use + \code{\link[readr]{read_delim}} or one of its sibling functions from the + readr package (\url{https://cran.r-project.org/package=readr}) to coax the + text into a data frame. +} \examples{ clip_text <- read_clip() }