Displaying 2 results from an estimated 2 matches for "matchm".
Did you mean:
match
2010 Aug 09
2
efficient matrix element comparison
...to convert the For loop to a more efficient method. It simply loops through a large vector checking if the numeric element is not equal to the index of that element. The following example demonstrates a simplified example:
> rows <- 10
> collusionM <- Matrix(0,10,10,sparse=TRUE)
> matchM <- matrix(c(1,2,3,4,4,6,7,9,9,10))
>
> for (j in 1:rows) if (j != matchM[j]) collusionM[j,matchM[j]] <- collusionM[j,matchM[j]]+1
> collusionM
10 x 10 sparse Matrix of class "dgCMatrix"
[1,] . . . . . . . . . .
[2,] . . . . . . . . . .
[3,] . ....
2005 Oct 13
0
Maps package, coloration
...sperate)
t <- t[order(t$ordin),]
# a little accounting for the colors
t$PVar <- (t$PVar-min(t$PVar,na.rm=T))/(max(t$PVar,na.rm=T)-min(t
$PVar,na.rm=T))
t$col <- round((((t$PVar*100)-100)*-1),0)
# t$col is now a collection of integers from 1 to 100
# again, redundancy out of desperation.
matchm <- match.map('county',t$mapm,exact=T,warn=T)
# define colors with the heat.map palette
color <- heat.colors(100)[t$col[matchm]]
# alternative (also not working)
color <- heat.colors(100)[t$col]
# use the colors to fill the map
map('county',fill=T,col=color)
Michaell Tay...