50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

rvec (version 0.0.7)

extract_draw: Extract a Single Draw From an Rvec

Description

Extract a single draw from x. If a value is supplied for i, extract the ith draw; otherwise extract a random draw.

Usage

extract_draw(x, i = NULL)

Value

A vector, with type

  • double, if x has class "rvec_dbl",

  • integer, if x has class "rvec_int",

  • character, if x has class "rvec_chr",

  • logical, if x has class "rvec_lgl".

Arguments

x

An rvec.

i

Index for the draw to be extracted. A number between 1 and n_draw(x). If no value is supplied, a draw is chosen at random.

See Also

n_draw() Number of draws

Examples

Run this code
x <- rvec(matrix(1:50, ncol = 5))
extract_draw(x, i = 1)
extract_draw(x)

Run the code above in your browser using DataLab