Description Usage Format Examples
The data is stored as raster
* objects. The two features are stored
in bananas.x
and the class information in bananas$y
. This data set
allows visualization of predictive models in the two-dimensional feature
space.
1 |
bananas$x
is a two-dimensional raster stack with the features
and bananas.y
a one-dimensional raster with the class labels.
A data frame with a training set is also available (bananas$tr
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Not run:
require(raster)
data(bananas)
### plot the features and labels (raster)
plot(stack(bananas$x, bananas$y))
### plot the training data
plot( bananas$tr[, -1],
pch = ifelse(bananas$tr$y==1, 16, 4 ))
### the training data bananas$tr has been created as follows:
set.seed(123456)
tr.cells <- c( sample( which( values( bananas$y ) == 1 ), 20 ),
sample( ncell( bananas$y ), 500 ) )
bananas$tr <- c( y = rep( c( 1, 0 ), c( 20, 500 ) ),
extract( bananas$x, tr.cells ) )
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.