r - Using a data frame with x and y to fill in a matrix -
r question:i use data-frame x coordinates in 1 column , y coordinates in second column fill in matrix. matrix used heatmap()
create dendrogram.
here example:
> head(s1) db_num ad_num 1 2 8060 2 7 3553 3 8 4812 4 13 7745 5 24 3315 6 24 6012
i need know how make matrix if possible. data-frame's max value 15,490 guess matrix have 15,490 15,490. since matrix large guess have filled na rather zeros?
mtx <- matrix(na, 15490 , 15,490) mtx[ as.matrix(s1) ] <- 1 # 2 column matrix can used index
you need have sufficient machine resources if strategy. it's not going fit inside 4gb devices, or may fit run out of memory if try it. filling na not conserve space unless use sparse matrices pkg::matrix. continue believe need statistical advice more need coding advice, though appear have deleted earlier version of question. see sensible way forward build classification structure.
Comments
Post a Comment