eval_content: evaluate content blocked within r code

View source: R/render-utils.R

eval_contentR Documentation

evaluate content blocked within r code

Description

helper function for evaluating code from text

Usage

eval_content(x)

Arguments

x

any R object

Details

use "'r mean(c(2,3))'" to specify evaluating the mean(c(2,3)). If this syntax is not used, the values are passed through unaltered.

Value

the return value from evaluating the function, or the raw input (unaltered) if there is no function to be evaluated.

Examples

eval_content("`r mean(c(2,3))`")
eval_content("`mean(c(2,3))`")
eval_content(list(c=3))

USGS-R/meddle documentation built on April 29, 2023, 11:50 a.m.