#' ---
#' title: "Test: ZeroMatrix"
#' author: "Ivan Jacob Agaloos Pesigan"
#' date: "`r Sys.Date()`"
#' output: rmarkdown::html_vignette
#' vignette: >
#' %\VignetteIndexEntry{Test: ZeroMatrix}
#' %\VignetteEngine{knitr::rmarkdown}
#' %\VignetteEncoding{UTF-8}
#' ---
#'
#+ knitr_options, include=FALSE, cache=FALSE
knitr::opts_chunk$set(
error = TRUE,
collapse = TRUE,
comment = "#>",
out.width = "100%"
)
#'
#+ setup
library(testthat)
library(matrixR)
context("Test ZeroMatrix.")
#'
A <- matrix(1:9, ncol = 3)
B <- matrix(1:10, ncol = 2)
#'
#+ testthat
test_that("ZeroMatrix", {
expect_equal(
dim(A)[1],
dim(ZeroMatrix(dim(A)[1]))[1],
dim(ZeroMatrixFrom(A))[1]
)
expect_equal(
dim(A)[2],
dim(ZeroMatrix(dim(A)[1]))[2],
dim(ZeroMatrixFrom(A))[2]
)
expect_equal(
dim(B)[1],
dim(ZeroMatrix(dim(B)[1], dim(B)[2]))[1],
dim(ZeroMatrixFrom(B))[1]
)
expect_equal(
dim(B)[2],
dim(ZeroMatrix(dim(B)[1], dim(B)[2]))[2],
dim(ZeroMatrixFrom(B))[2]
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.