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

frame_matrix

Row-wise matrix creation


Description

Create matrices laying out the data in rows, similar to matrix(..., byrow = TRUE), with a nicer-to-read syntax. This is useful for small matrices, e.g. covariance matrices, where readability is important. The syntax is inspired by tribble().

Usage

frame_matrix(...)

Arguments

...

<dynamic-dots> Arguments specifying the structure of a frame_matrix. Column names should be formulas, and may only appear before the data. These arguments are processed with rlang::list2() and support unquote via !! and unquote-splice via !!!.

Value

A matrix.

See Also

See quasiquotation for more details on tidy dots semantics, i.e. exactly how the ... argument is processed.

Examples

frame_matrix(
  ~col1, ~col2,
  1,     3,
  5,     2
)

tibble

Simple Data Frames

v3.1.1
MIT + file LICENSE
Authors
Kirill Müller [aut, cre], Hadley Wickham [aut], Romain Francois [ctb], Jennifer Bryan [ctb], RStudio [cph]
Initial release

We don't support your browser anymore

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