I have the simple dataframe below:
DF2 = data.frame(agency_postcode = factor(rep(c(12345,45678,24124,32525,32325),2)),
car_group=factor(rep(c("Microcar","City car","Supermini","Compact","SUV"),2)),
transmission=factor(rep(c("automatic","manual"),5)))
and based on this I create an rhandsontable. The issue is that when I subset my dataframe I still get all the levels of the other columns in the dropdown while I would like to see only those related with the value I used to subset. In the example below I should have taken '12345'
when displaying the dropdown and not all of the levels.
library(rhandsontable)
rhandsontable(DF2[ which(DF2$car_group=='Microcar'), ], rowHeaders = NULL, width = 550, height = 300)
I found that dropdown shows all the factors that exist so I re-factored based on my subset like:
newdata <- DF2[ which(DF2$car_group=='Microcar'), ]
for(i in 1:ncol(newdata)){
newdata[,i] <- factor(newdata[,i])
}