I have an R question: efficiently building a matrix from rows. data rows as a data frame:
name, date, value
('a', '2014-01-02', 100)
('b', '2013-12-22', 200)
('a', '2014-02-12', 300)
('c', '2014-01-05', 400)
I'd like to build a matrix , in this case, it's 3 x 4, 3 names, and 4 dates, with the correct values padded into this matrix.
in the matrix,
row labels: a,b,c
column labels: '2013-12-22', '2014-01-02', '2014-01-05', '2014-02-12'
example value:
mat[ 1, 2 ] = 100
mat[1,4] = 0
should i use hashtable ? or you have a better way to efficiently do it?