From 6935cc6e4ac872a24bc49ca6f0434e3c20e7ac16 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 9 Jan 2019 08:54:50 +0100 Subject: [PATCH] Moved magrittr to Imports, and added the pipe in importFrom These changes allow to use the package without having to explicitely load the magrittr package. As this package doesn't work without having to library(magrittr) before, it makes sense to have magrittr listed in the dependecies. --- DESCRIPTION | 5 +++-- NAMESPACE | 2 ++ R/utils-pipe.R | 11 +++++++++++ backpipe.Rproj | 32 ++++++++++++++++---------------- man/insert_backpipe.Rd | 2 +- man/pipe.Rd | 12 ++++++++++++ 6 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 R/utils-pipe.R create mode 100644 man/pipe.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 9a170a8..9ad4270 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,8 +16,9 @@ Description: Provides a backward-pipe operator for 'magrittr' (%<%) or shortcut. Depends: R (>= 3.1.0) +Imports: + magrittr Suggests: - magrittr (>= 1.5), pipeR (>= 0.6.0.6), R6 (>= 2.1.1), testthat (>= 1.0.0), @@ -28,7 +29,7 @@ Suggests: License: GPL-2 | file LICENSE URL: https://github.com/decisionpatterns/backpipe BugReports: https://github.com/decisionpatterns/backpipe/issues -RoxygenNote: 6.0.1.9000 +RoxygenNote: 6.1.0 Roxygen: list(markdown = TRUE) Encoding: UTF-8 VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 6ae3878..b2cff4e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,7 @@ # Generated by roxygen2: do not edit by hand export("%<%") +export("%>%") export(backpipe) export(insert_backpipe) +importFrom(magrittr,"%>%") diff --git a/R/utils-pipe.R b/R/utils-pipe.R new file mode 100644 index 0000000..fb8c818 --- /dev/null +++ b/R/utils-pipe.R @@ -0,0 +1,11 @@ +#' Pipe operator +#' +#' See \code{magrittr::\link[magrittr]{\%>\%}} for details. +#' +#' @name %>% +#' @rdname pipe +#' @keywords internal +#' @export +#' @importFrom magrittr %>% +#' @usage lhs \%>\% rhs +NULL diff --git a/backpipe.Rproj b/backpipe.Rproj index eeb0ea5..3a76475 100755 --- a/backpipe.Rproj +++ b/backpipe.Rproj @@ -1,16 +1,16 @@ -Version: 1.0 - -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX - -BuildType: Package -PackageInstallArgs: --no-multiarch --with-keep.source +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +BuildType: Package +PackageInstallArgs: --no-multiarch --with-keep.source diff --git a/man/insert_backpipe.Rd b/man/insert_backpipe.Rd index ba4abe0..ed1d674 100644 --- a/man/insert_backpipe.Rd +++ b/man/insert_backpipe.Rd @@ -7,7 +7,7 @@ insert_backpipe() } \description{ -Call this function to insert \code{\%<-\%} at the cursor position. +Call this function to insert \code{\%<-\%} at the cursor position. } \details{ Use \strong{Tools > Modify Keyboard Shortcuts} to bind a ->.; ->.; diff --git a/man/pipe.Rd b/man/pipe.Rd new file mode 100644 index 0000000..b7daf6a --- /dev/null +++ b/man/pipe.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils-pipe.R +\name{\%>\%} +\alias{\%>\%} +\title{Pipe operator} +\usage{ +lhs \%>\% rhs +} +\description{ +See \code{magrittr::\link[magrittr]{\%>\%}} for details. +} +\keyword{internal}