/
here.Rd
33 lines (32 loc) · 852 Bytes
/
here.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/here.r
\name{here}
\alias{here}
\title{Capture current evaluation context.}
\usage{
here(f)
}
\arguments{
\item{f}{a function that does non-standard evaluation}
}
\description{
This function captures the current context, making it easier
to use \code{**ply} with functions that do special evaluation and
need access to the environment where ddply was called from.
}
\examples{
df <- data.frame(a = rep(c("a","b"), each = 10), b = 1:20)
f1 <- function(label) {
ddply(df, "a", mutate, label = paste(label, b))
}
\dontrun{f1("name:")}
# Doesn't work because mutate can't find label in the current scope
f2 <- function(label) {
ddply(df, "a", here(mutate), label = paste(label, b))
}
f2("name:")
# Works :)
}
\author{
Peter Meilstrup, \url{https://github.com/crowding}
}