Togaware DATA MINING
Desktop Survival Guide
by Graham Williams
Google

Replace Indices By Names



> city.name <- c("Munich", "Paris", "Tokyo", "London", "Boston")
> X <- cbind(c(2, 5, 5), c(4, 1, 3))
> X
       [,1] [,2]
  [1,]    2    4
  [2,]    5    1
  [3,]    5    3
> matrix(city.name[X], ncol = 2)
       [,1]     [,2]    
  [1,] "Paris"  "London"
  [2,] "Boston" "Munich"
  [3,] "Boston" "Tokyo"



Copyright © 2004-2006 Graham.Williams@togaware.com
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware.