Displaying 1 result from an estimated 1 matches for "55nd".
Did you mean:
552d
2005 Aug 04
2
Avoiding for loop
.... Each row of the data file corresponds to a row
of the matrix, where each number in the row tells me what column a "1"
or "-1" should go into. So the first row in the data snippet above
means that the first row of my matrix needs to have a 1 in the 1st
column, and a -1 in the 55nd column. (And 0 elsewhere, which is
already there as I've created the matrix filled with 0s beforehand.)
So my current code looks like:
if(nrow(rawdata) >= 1) for(i in 1:nrow(rawdata)) {
X[i, rawdata[i, 1]] <- 1
X[i, rawdata[i, 2]]...