Added R equivalents to zeros() and ones()

This commit is contained in:
Waldir Leoncio 2019-12-17 11:24:58 +01:00
parent 220c81a237
commit 98affbfc1c
4 changed files with 92 additions and 0 deletions

17
man/ones.Rd Normal file
View file

@ -0,0 +1,17 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/zeros_ones.R
\name{ones}
\alias{ones}
\title{Matrix of ones}
\usage{
ones(n1, n2 = n1)
}
\arguments{
\item{n1}{number of rows}
\item{n2}{number of columns}
}
\description{
wrapper of `zeros_or_ones()` that replicates the behavior of
the `ones()` function on Matlab
}

17
man/zeros.Rd Normal file
View file

@ -0,0 +1,17 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/zeros_ones.R
\name{zeros}
\alias{zeros}
\title{Matrix of zeros}
\usage{
zeros(n1, n2 = n1)
}
\arguments{
\item{n1}{number of rows}
\item{n2}{number of columns}
}
\description{
wrapper of `zeros_or_ones()` that replicates the behavior of
the `zeros()` function on Matlab
}

27
man/zeros_or_ones.Rd Normal file
View file

@ -0,0 +1,27 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/zeros_ones.R
\name{zeros_or_ones}
\alias{zeros_or_ones}
\title{Matrix of zeros or ones}
\usage{
zeros_or_ones(n, x)
}
\arguments{
\item{n}{scalar or 2D vector}
\item{x}{value to fill matrix with}
}
\value{
n-by-n matrix filled with `x`
}
\description{
Generates a square or rectangular matrix of zeros or ones
}
\details{
This is a wrapper function to replicate the behavior of the
`zeros()` and the `ones()` functions on Matlab
}
\note{
Actually works for any `x`, but there's no need to bother imposing
validation controls here.
}