Learn R Programming

simDAG (version 0.3.0)

rconstant: Use a single constant value for a root node

Description

This is a small convenience function that simply returns the value passed to it, in order to allow the use of a constant node as root node in the sim_from_dag function.

Usage

rconstant(n, constant)

Value

Returns a vector of length n with the same type as constant.

Arguments

n

The number of times the constant should be repeated.

constant

A single value of any kind which is used as the only value of the resulting variable.

Author

Robin Denz

Examples

Run this code
library(simDAG)

rconstant(n=10, constant=7)

rconstant(n=4, constant="Male")

Run the code above in your browser using DataLab