Learn R Programming

ramify (version 0.2.0)

fill: Fill a Matrix

Description

Create a matrix filled with the value x.

Usage

fill(x, nrow = 1, ncol = 1, ...)

falses(nrow = 1, ncol = 1, ...)

trues(nrow = 1, ncol = 1, ...)

ones(nrow = 1, ncol = 1, ...)

zeros(nrow = 1, ncol = 1, ...)

Arguments

x
The (single) value to fill the matrix with.
nrow
The desired number of rows.
ncol
The desired number of columns.
...
Further dimensions of the array.

Value

  • A matrix or array filled with the value x.

See Also

ones, zeros, falses, trues, mat, matrix.

Examples

Run this code
fill(pi, 3, 5)  # 3-by-5 matrix filled with the value of pi
fill(pi, 3, 5, 2, 2)  # 3-by-5-by-2-by-2 array filled with the value of pi
pi * ones(3, 5)

Run the code above in your browser using DataLab