I am trying to plot a couple of feature columns against the categories for a data.table. However, I am not get color coding by category which happens automatically when a similar formatted iris dataset is plotted.
library(data.table)
library(caret)
dtData <- data.table(
Index = seq(1:9),
ColumnA = as.numeric(c(1018,1051,979,1036,963,1055,1063,968,1036)),
ColumnB = as.numeric(c(566,600,529,530,516,586,562,514,537)),
Category = as.factor(c("hybrid","mountain","road","hybrid","road","mountain","mountain","road","hybrid"))
)
featurePlot(x=dtData[,2:3],y = dtData[,4], plot="pairs")
When I run the code above, I get the following plot:
It is not colored by category and instead the category also appears as a column which is not as expected. Any pointers on resolving this?
Thanks much.