Skip to content

Commit 283b728

Browse files
author
Jonathan Chang
committed
Further improve document; fix bug when a method matches all possible prefixes.
1 parent 8c9b80c commit 283b728

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

pkg/R/Rpipe.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Rpipe.eval <- function(e1, expr) {
5858
envir = as.environment(-1),
5959
ifnotfound = list(NULL),
6060
inherits = TRUE)
61-
func.names <- lookups[-which(sapply(lookups, is.null))]
61+
func.names <- which(sapply(lookups, function(x) !is.null(x)))
6262
if (length(func.names) == 0) {
6363
stop(paste("Could not find pipe function", expr[1]))
6464
}

pkg/man/Rpipe.Rd

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,29 @@
44
Manipulate a data frame through a series of pipe operations.
55
}
66
\description{
7-
7+
This provides an alternative syntax for calling a series of operations successively on data frames. Rather than nesting/composing function calls, this implements a pipe operator similar to that in command shells. This allows users to generate data frames by applying stages of data frame operations one after the other.
88
}
99
\usage{
1010
df %|% operation()
1111
}
1212
\arguments{
1313
\item{df}{
1414
A data frame to operate on. Note that this can be the output of another \code{Rpipe} stage.}
15-
\item{e2}{
16-
%% ~~Describe \code{e2} here~~
15+
\item{operation}{
16+
Any function call which takes a data frame and returns a data frame. Note that in addition to typical operations such as subset, this package also makes available/changes the semantics of \code{group}, \code{aggregate}, and \code{sort}.
1717
}
1818
}
19-
\details{
20-
%% ~~ If necessary, more details than the description above ~~
21-
}
2219
\value{
23-
%% ~Describe the value returned
24-
%% If it is a LIST, use
25-
%% \item{comp1 }{Description of 'comp1'}
26-
%% \item{comp2 }{Description of 'comp2'}
27-
%% ...
20+
A data frame resulting from calling \code{operation} with \code{df} inserted as the first argument.
2821
}
2922
\author{
3023
Jonathan Chang <jonchang@fb.com>
3124
}
3225

3326
\examples{
34-
iris %|%
35-
subset(Sepal.Width > 3.0) %|%
36-
sort(Sepal.Length) %|%
37-
group(Species, head()) %|%
38-
aggregate(Species, Mean.Petal.Width = mean(Petal.Width))
27+
iris \%|\%
28+
subset(Sepal.Width > 3.0) \%|\%
29+
sort(Sepal.Length) \%|\%
30+
group(Species, head()) \%|\%
31+
aggregate(Species, Mean.Petal.Width = mean(Petal.Width))
3932
}

0 commit comments

Comments
 (0)