DT not filtering factor column correctly when it contains value of 'NA' (for North America) in shiny

I am using DT in shiny to allow users to filter data:

dt <- DT::datatable(
choice_df(),
filter = list(position = 'top', clear = FALSE),
options = list(
  pageLength = 5,
  searchCols = list(
    NULL,
    list(search = default_crop),
    NULL,
    NULL
  )
)

)
}}, server=TRUE)

It is working great. However, when a factor column contains value of string 'NA' ( it stands for North America), it does not work properly. If nothign is put in the filter box, I can see 'NA', and other values; if I select a value other than 'NA' it is working, but when I select only 'NA'
, it says, "No matching records found".

This may be a bug in DT. You might want to check out the Github.

Thanks woodward!

DT itself seems to work as it is behaving correctly if I run in console.
In Shiny, if I cahange "NA" to "N_A" it would work fine. So it seems to me shiny is trying to be intelligent and treats string "NA" as missing data, but that's just a guess.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.