Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ffrandom

Generate ff vector with draws from distribution


Description

A convenience function to generate ff vectors with draws from random distributions using functions such as runif, rnorm and rlnorm.

Usage

ffrandom(n, rfun = runif, ..., vmode = NULL)

Arguments

n

number of observations

rfun

a function generating the draws from the random distribution. This function should expect the number of draws as its first argument. Valid examples are the routines runif, rnorm, and rlnorm.

...

additional arguments are passed on to rfun.

vmode

the vmode of the resulting vector. See ff. If none given the vmode is determined from a single draw from rfun.

Details

Before generating the vector a single draw is taken from the distribution. This might be important if one tries to reproduce draws directly from rfun.

Value

An ff vector with draws from the distribution.

Examples

n <- ffrandom(1E3, rnorm, mean = 10, sd = 5)

set.seed(123)
runif(1)
a <- runif(10)
set.seed(123)
b <- ffrandom(10, runif)
identical(a, b[])

ffbase

Basic Statistical Functions for Package 'ff'

v0.13.3
GPL-3
Authors
Edwin de Jonge, Jan Wijffels, Jan van der Laan
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.