Description Usage Arguments Value Examples
Generic function to map values from one set to another using a user-supplied lookup table
1 2 3 4 5 6 7 |
x |
the object to map values from |
lookup |
the lookup table. The first column is the "key" the second column is the "value". |
a new object where the original values have been filled in with the values in the lookup table
1 2 3 4 5 6 7 8 9 10 11 12 | x <- BrainSpace(c(10,10,10), c(1,1,1))
vol <- BrainVolume(sample(1:10, 10*10*10, replace=TRUE), x)
## lookup table is list
lookup <- lapply(1:10, function(i) i*10)
ovol <- fill(vol, lookup)
## lookup table is matrix. First column is key, second column is value
names(lookup) <- 1:length(lookup)
lookup.mat <- cbind(as.numeric(names(lookup)), unlist(lookup))
ovol2 <- fill(vol, lookup.mat)
all.equal(as.vector(ovol2), as.vector(ovol))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.