triplets_to_matrix: Conversion from triplet/coordinate format to matrix

Description Usage Arguments Details Value Author(s) Examples

View source: R/CMF.R

Description

This function is the inverse of matrix_to_triplets. It converts a matrix represented as a set of triplets into an object of the class matrix. The missing entries (the ones not present in the triplet representation) are filled in as NA.

Usage

1

Arguments

triplets

A matrix in triplet/coordinate format

Details

See matrix_to_triplets for a description of the representation.

Value

The input matrix as a normal matrix of class matrix

Author(s)

Arto Klami and Lauri V<c3><a4>re

Examples

1
2
3
4
5
x <- matrix(c(1,2,NA,NA,5,6),nrow=3)
triplet <- matrix_to_triplets(x)
print(triplet)
xnew <- triplets_to_matrix(triplet)
print(xnew)

CMF documentation built on May 30, 2017, 5:24 a.m.