Learn R Programming

propagate (version 1.0-6)

makeDat: Create a dataframe from the variables defined in an expression

Description

Creates a dataframe from the variables defined in an expression by cbinding the corresponding data found in the workspace. This is a convenience function for creating a dataframe to be passed to propagate, when starting with data which was simulated from distributions, i.e. when type = "sim". Will throw an error if a variable is defined in the expression but is not available from the workspace.

Usage

makeDat(expr)

Arguments

expr

an expression to be use for propagate.

Value

A dataframe containing the data defined in expr in columns.

Examples

Run this code
# NOT RUN {
## Simulating from uniform
## and normal distribution,
## run 'propagate'.
EXPR1 <- expression(a + b^c)
a <- rnorm(100000, 12, 1)
b <- rnorm(100000, 5, 0.1)
c <- runif(100000, 6, 7)

DAT1 <- makeDat(EXPR1)
propagate(EXPR1, DAT1, type = "sim", cov = FALSE)
# }

Run the code above in your browser using DataLab