Learn R Programming

rvec (version 0.0.7)

as_list_col: Convert to List Column

Description

Convert an rvec or matrix to a list that can be used as a list column in a data frame.

Usage

as_list_col(x)

# S3 method for rvec as_list_col(x)

# S3 method for matrix as_list_col(x)

Value

A list:

  • If x is an rvec, then the list contains length(x) vectors, each of which has n_draw(x) elements.

  • If x is a matrix, then the list contains nrow(x) vectors, each of which has ncol(x) elements.

Arguments

x

An rvecs or matrix.

See Also

  • rvec() to construct an rvec.

  • expand_from_rvec() to convert a data frame from using rvecs to using draw and value columns.

  • as_rvar???

  • converting rvecs to

  • Functions for summarising and plotting distributions in package ggdist understand list columns.

Examples

Run this code
l <- list(1:3,
          4:6)
r <- rvec(l)
as_list_col(r)

Run the code above in your browser using DataLab