R and DT: display filter parameters in specific columns

I want to use DT to display some data and only allow filtering for some columns. This code:

df <- data.frame(c("john","susy"), c("a", "b")) names(df) <- c("name", "grade") DT::datatable(df, filter = 'top') 

Creates a table with filtering options for each column:

Now say that I want the filter window to be visible for the "name" column. How can I do it? I thought I could use a filter as follows:

 df <- data.frame(c("john","susy"), c("a", "b")) names(df) <- c("name", "grade") DT::datatable(df, filter = c('none', 'top')) 

Include it only in the second column, but it does not work (this requires only one character argument). Any ideas? Please note that I want all the fields to be searched in the upper right search box, but I only need a field with a column for the second column.

+5
source share

Source: https://habr.com/ru/post/1245235/


All Articles