r - Warning messages when subsetting on integer variables -
i have small shiny application in i'm displaying variable names checkboxgroupinput , based on selection i'm subsetting data table variables , displaying it.
what observed when variable of integer type label selected, there warning message on rstudio console :
warning in formatc(x = c(36l, 29l, 20l, 25l, 48l, 42l, 19l, 26l, 36l, 39l, : class of 'x' discarded
if change variable type character(in case label gone) in data.table warning goes away - these warning messages mean , how rid of them without change type of columns? here code :
server.r library(shiny) dft<-data.table(name=c("a","b","c"),age=c(10l,12l,13l)) label(dft$name)<-"full name" label(dft$age)<-"age of patient" shinyserver(function(input, output) { output$x<- renderui({ checkboxgroupinput("g1","g1label",names(dft)) }) output$y<- rendertable({ if (length(input$g1 > 0)) {subset(dft,select=c(as.vector(input$g1)))} }) }) ui.r library(shiny) shinyui(fluidpage( uioutput("x") , tableoutput("y") ))