1
#' magrittr - Ceci n'est pas un pipe
2
#'
3
#' The magrittr package offers a set of operators which promote semantics 
4
#' that will improve your code by
5
#' \itemize{
6
#'   \item structuring sequences of data operations left-to-right
7
#'         (as opposed to from the inside and out),
8
#'   \item avoiding nested function calls, 
9
#'   \item minimizing the need for local variables and function definitions, and
10
#'   \item making it easy to add steps anywhere in the sequence of operations.
11
#' }
12
#' The operators pipe their left-hand side values forward into expressions that
13
#' appear on the right-hand side, i.e. one can replace `f(x)` with 
14
#' \code{x \%>\% f}, where \code{\%>\%} is the (main) pipe-operator.
15
#' 
16
#' Consider the example below. Four operations are performed to 
17
#' arrive at the desired data set, and they are written in a natural order: 
18
#' the same as the order of execution. Also, no temporary variables are needed.
19
#' If yet another operation is required, it is straight-forward to add to the
20
#' sequence of operations whereever it may be needed.
21
#' 
22
#' For a more detailed introduction see the vignette 
23
#' (`vignette("magrittr")`) or the documentation pages for the
24
#' available operators:\cr
25
#' \tabular{ll}{
26
#'    \code{\link{\%>\%}}  \tab pipe.\cr
27
#'    \code{\link{\%T>\%}} \tab tee pipe.\cr
28
#'    \code{\link{\%<>\%}} \tab assignment pipe.\cr
29
#'    \code{\link{\%$\%}}  \tab exposition pipe.\cr
30
#' }
31
#' 
32
#' @useDynLib magrittr, .registration = TRUE
33
#' @examples
34
#' \dontrun{
35
#' 
36
#' the_data <-
37
#'   read.csv('/path/to/data/file.csv') %>%
38
#'   subset(variable_a > x) %>%
39
#'   transform(variable_c = variable_a/variable_b) %>%
40
#'   head(100)
41
#' }
42
#' @keywords internal
43
"_PACKAGE"
44

45
.onLoad <- function(lib, pkg) {
46 0
  .Call(magrittr_init, asNamespace("magrittr"))
47
}

Read our documentation on viewing source code .

Loading