Learn R Programming

arrowheadr (version 1.0.2)

v2matrix: Convert a vector to a matrix

Description

Convert a vector to a matrix

Usage

v2matrix(x, ncol = 2, byrow = TRUE)

Value

a matrix

Arguments

x

vector

ncol

number of columns

byrow

logical. convert by row

Examples

Run this code
v2matrix(c(1,2,3,4))

Run the code above in your browser using DataLab