-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathreplace_symbol_in_expr.Rd
More file actions
56 lines (50 loc) · 1.33 KB
/
replace_symbol_in_expr.Rd
File metadata and controls
56 lines (50 loc) · 1.33 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/quo.R
\name{replace_symbol_in_expr}
\alias{replace_symbol_in_expr}
\title{Replace Symbols in an Expression}
\usage{
replace_symbol_in_expr(expression, target, replace)
}
\arguments{
\item{expression}{Expression
\describe{
\item{Permitted values}{a quoted expression, e.g., created by \code{expr()}}
\item{Default value}{none}
}}
\item{target}{Target symbol
\describe{
\item{Permitted values}{an unquoted symbol, e.g., \code{AVAL}}
\item{Default value}{none}
}}
\item{replace}{Replacing symbol
\describe{
\item{Permitted values}{an unquoted symbol, e.g., \code{AVAL}}
\item{Default value}{none}
}}
}
\value{
The expression where every occurrence of the symbol \code{target} is
replaced by \code{replace}
}
\description{
Replace symbols in an expression
}
\examples{
library(rlang)
replace_symbol_in_expr(expr(AVAL), target = AVAL, replace = AVAL.join)
replace_symbol_in_expr(expr(AVALC), target = AVAL, replace = AVAL.join)
replace_symbol_in_expr(expr(desc(AVAL)), target = AVAL, replace = AVAL.join)
replace_symbol_in_expr(expr(if_else(AVAL > 0, AVAL, NA)), AVAL, AVAL.join)
}
\seealso{
Helpers for working with Quosures:
\code{\link{add_suffix_to_vars}()},
\code{\link{expr_c}()},
\code{\link{replace_values_by_names}()}
}
\author{
Stefan Bundfuss
}
\concept{quo}
\keyword{quo}