xSM2DF: Function to create a data frame (with three columns) from a...

Description Usage Arguments Value Note See Also Examples

Description

xSM2DF is supposed to create a data frame (with three columns) from a (sparse) matrix. Only nonzero/nonna entries from the matrix will be kept in the resulting data frame.

Usage

1
xSM2DF(data, verbose = TRUE)

Arguments

data

a matrix or an object of the dgCMatrix class (a sparse matrix)

verbose

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

Value

a data frame containing three columns: 1st column for row names, 2nd for column names, and 3rd for numeric values

Note

none None

See Also

xSM2DF

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',2), c('R4','C1',1))
data <- xSparseMatrix(input.file)
# convert into a data frame
res_df <- xSM2DF(data)
res_df

XGR documentation built on June 18, 2019, 3:01 p.m.

Related to xSM2DF in XGR...