dcSparseMatrix: Function to create a sparse matrix for an input file with...

Description Usage Arguments Value Note See Also Examples

View source: R/dcSparseMatrix.r

Description

dcSparseMatrix is supposed to create a sparse matrix for an input file with three columns.

Usage

1
dcSparseMatrix(input.file, verbose = T)

Arguments

input.file

an input file containing three columns: 1st column for rows, 2nd for columns, and 3rd for numeric values. Alternatively, the input.file can be a matrix or data frame, assuming that input file has been read. Note: the file should use the tab delimiter as the field separator between columns

verbose

logical to indicate whether the messages will be displayed in the screen. By default, it sets to TRUE for display

Value

an object of the dgCMatrix class (a sparse matrix)

Note

None

See Also

dcAlgoPredictMain

Examples

1
2
3
4
5
6
7
# create a sparse matrix of 4 X 2
input.file <- rbind(c('R1','C1',1), c('R2','C1',1), c('R2','C2',1),
c('R3','C2',1), c('R4','C1',1))
res <- dcSparseMatrix(input.file)
res
# get a full matrix
as.matrix(res)

dcGOR documentation built on May 2, 2019, 6:14 p.m.

Related to dcSparseMatrix in dcGOR...