# 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)
Run the code above in your browser using DataLab