Learn R Programming

poputils (version 0.4.1)

matrix_to_list_of_cols: Turn a Matrix Into a List of Columns or Rows

Description

Given a matrix, create a list, each element of which contains a column or row from the matrix.

Usage

matrix_to_list_of_cols(m)

matrix_to_list_of_rows(m)

Value

  • matrix_to_list_of_cols() A list of vectors, each of which is a column from x.

  • matrix_to_list_of_rows(), A list of vectors, each of which is a row from x.

Arguments

m

A matrix

Details

matrix_to_list_of_cols() and `matrix_to_list_of_rows() are internal functions, for use by developers, and would not normally be called directly by end users.

Examples

Run this code
m <- matrix(1:12, nrow = 3)
matrix_to_list_of_cols(m)
matrix_to_list_of_rows(m)

Run the code above in your browser using DataLab