rvec {rvec} | R Documentation |
Create an object of class "rvec"
, based
on input data.
rvec(x)
rvec_chr(x = NULL)
rvec_dbl(x = NULL)
rvec_int(x = NULL)
rvec_lgl(x = NULL)
x |
A matrix, a list of vectors, an atomic vector, or an rvec. |
Class "rvec"
has four subclasses, each dealing with
a diffent type:
"rvec_dbl"
doubles
"rvec_int"
integers
"rvec_lgl"
logical
"rvec_chr"
character
These subclasses are analogous to double()
,
integer()
, logical()
, and character()
vectors.
Function rvec()
chooses the subclass, based on
x
. Functions rvec_dbl()
, rvec_int()
,
rvec_lgl()
, and rvec_chr()
each create
objects of a particular subclass.
x
can be
a matrix, where each row is a set of draws for an unknown quantity;
a list, where each element is a set of draws;
an atomic vector, which is treated as a single-column matrix; or
an rvec.
An rvec with the following class:
rvec_dbl()
: "rvec_dbl"
rvec_int()
: "rvec_int"
rvec_lgl()
: "rvec_lgl"
rvec_chr()
: "rvec_chr"
rvec()
: "rvec_chr"
, "rvec_dbl"
"rvec_int"
, or "rvec_lgl"
new_rvec()
Create a blank rvec.
collapse_to_rvec()
Create rvecs within
a data frame.
rnorm_rvec()
, rbinom_rvec()
, etc. Create rvecs
representing probability distributions.
m <- rbind(c(-1.5, 2, 0.2),
c(-2.3, 3, 1.2))
rvec_dbl(m)
l <- list(rpois(100, lambda = 10.2),
rpois(100, lambda = 5.5))
rvec(l)
rvec(letters[1:5])
l <- list(a = c(TRUE, FALSE),
b = c(FALSE, TRUE))
rvec(l)