xSM2DF | R Documentation |
xSM2DF
is supposed to create a data frame (with three columns)
from a (sparse) matrix. Only nonzero entries from the matrix will be
kept in the resulting data frame.
xSM2DF(data, verbose = TRUE)
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 |
a data frame containing three columns: 1st column for row names, 2nd for column names, and 3rd for numeric values
none None
xSM2DF
# 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 a full matrix res_df <- xSM2DF(data) res_df