Re: [R] shiny datatables column filtering plugin
Thank you for checking Yihui, on the off chance are you familiar with any other methods to filter on multiple conditions? On Tue, Sep 2, 2014 at 11:07 PM, Yihui Xie x...@yihui.name wrote: I just tested it and this plugin does not seem to work with the new .DataTable() API in DataTables 1.10.x, so I guess it is unlikely to make it work in (the current development version of) shiny. It is not in the official list of plugins, either: http://www.datatables.net/extensions/index Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Tue, Sep 2, 2014 at 11:59 AM, Charles Determan Jr deter...@umn.edu wrote: Greetings, I am currently exploring some capabilities of the 'Shiny' package. I am currently working with the most recent version of 'shiny' from the rstudio github repository (version - 0.10.1.9006) in order to use the most up to date datatables plugin. Using the ggplot2 diamonds dataset, I can easily set columns as unsearchable (commented out below) and I could also subset out all the 'Ideal' diamonds for example, however I cannot filter out multiple conditions such as 'Ideal' and 'Fair' diamonds together. From my searching, this multiple filtering can be done with checkboxes from the column using the jquery column filtering plugin ( http://jquery-datatables-column-filter.googlecode.com/svn/trunk/checkbox.html ). Despite this, I cannot get this plugin to work with my shiny app. Any insight would be appreciated. library(shiny) library(ggplot2) runApp( list(ui = basicPage( h1('Diamonds DataTable with TableTools'), # added column filter plugin singleton(tags$head(tags$script(src=' https://code.google.com/p/jquery-datatables-column-filter/source/browse/trunk/media/js/jquery.dataTables.columnFilter.js ', type='text/javascript'))), dataTableOutput(mytable) ) ,server = function(input, output) { output$mytable = renderDataTable({ diamonds[,1:6] }, options = list( pageLength = 10,# columnDefs = I('[{targets: [0,1], searchable: false}]') columnFilter = I('[{ columnDefs: [targets: [0,1], type: checkbox] }]') ) ) } )) Charles Charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] shiny datatables column filtering plugin
The built-in version of DataTables in shiny has already supported numeric ranges. For a numeric column x in data, if you type a,b in the search box, the data will be filtered using a = x = b. The check boxes are not supported, but you can use regular expressions (more flexible) to achieve the same thing, e.g. (this example requires the development version of shiny: https://groups.google.com/forum/#!topic/shiny-discuss/-0u-wTnq_lA) library(shiny) runApp(list( ui = fluidPage( dataTableOutput(mytable) ), server = function(input, output) { output$mytable = renderDataTable( iris[sample(nrow(iris)), ], options = list(search = list(regex = TRUE)) ) } )) Then you can search for ^setosa|versicolor$, which means both setosa and versicolor in the iris data. Or 4,5 in the search box of Sepal.Length to filter this column. Depending on what you want, this may or may not be enough. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Wed, Sep 3, 2014 at 7:12 AM, Charles Determan Jr deter...@umn.edu wrote: Thank you for checking Yihui, on the off chance are you familiar with any other methods to filter on multiple conditions? On Tue, Sep 2, 2014 at 11:07 PM, Yihui Xie x...@yihui.name wrote: I just tested it and this plugin does not seem to work with the new .DataTable() API in DataTables 1.10.x, so I guess it is unlikely to make it work in (the current development version of) shiny. It is not in the official list of plugins, either: http://www.datatables.net/extensions/index Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Tue, Sep 2, 2014 at 11:59 AM, Charles Determan Jr deter...@umn.edu wrote: Greetings, I am currently exploring some capabilities of the 'Shiny' package. I am currently working with the most recent version of 'shiny' from the rstudio github repository (version - 0.10.1.9006) in order to use the most up to date datatables plugin. Using the ggplot2 diamonds dataset, I can easily set columns as unsearchable (commented out below) and I could also subset out all the 'Ideal' diamonds for example, however I cannot filter out multiple conditions such as 'Ideal' and 'Fair' diamonds together. From my searching, this multiple filtering can be done with checkboxes from the column using the jquery column filtering plugin ( http://jquery-datatables-column-filter.googlecode.com/svn/trunk/checkbox.html). Despite this, I cannot get this plugin to work with my shiny app. Any insight would be appreciated. library(shiny) library(ggplot2) runApp( list(ui = basicPage( h1('Diamonds DataTable with TableTools'), # added column filter plugin singleton(tags$head(tags$script(src='https://code.google.com/p/jquery-datatables-column-filter/source/browse/trunk/media/js/jquery.dataTables.columnFilter.js', type='text/javascript'))), dataTableOutput(mytable) ) ,server = function(input, output) { output$mytable = renderDataTable({ diamonds[,1:6] }, options = list( pageLength = 10,# columnDefs = I('[{targets: [0,1], searchable: false}]') columnFilter = I('[{ columnDefs: [targets: [0,1], type: checkbox] }]') ) ) } )) Charles Charles __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] shiny datatables column filtering plugin
Thank you Yihui, this would certainly work for me however I have having trouble getting the regex to work appropriately. I am using the developmental version of shiny and have copied your code. I launch the app and the filtering of numbers works fine (i.e. 4,5) but the search for setosa and versicolor gives me a blank datatable. Is there some dependency that I am missing that would prevent this regex to work with shiny? On Wed, Sep 3, 2014 at 11:27 AM, Yihui Xie x...@yihui.name wrote: The built-in version of DataTables in shiny has already supported numeric ranges. For a numeric column x in data, if you type a,b in the search box, the data will be filtered using a = x = b. The check boxes are not supported, but you can use regular expressions (more flexible) to achieve the same thing, e.g. (this example requires the development version of shiny: https://groups.google.com/forum/#!topic/shiny-discuss/-0u-wTnq_lA) library(shiny) runApp(list( ui = fluidPage( dataTableOutput(mytable) ), server = function(input, output) { output$mytable = renderDataTable( iris[sample(nrow(iris)), ], options = list(search = list(regex = TRUE)) ) } )) Then you can search for ^setosa|versicolor$, which means both setosa and versicolor in the iris data. Or 4,5 in the search box of Sepal.Length to filter this column. Depending on what you want, this may or may not be enough. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Wed, Sep 3, 2014 at 7:12 AM, Charles Determan Jr deter...@umn.edu wrote: Thank you for checking Yihui, on the off chance are you familiar with any other methods to filter on multiple conditions? On Tue, Sep 2, 2014 at 11:07 PM, Yihui Xie x...@yihui.name wrote: I just tested it and this plugin does not seem to work with the new .DataTable() API in DataTables 1.10.x, so I guess it is unlikely to make it work in (the current development version of) shiny. It is not in the official list of plugins, either: http://www.datatables.net/extensions/index Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Tue, Sep 2, 2014 at 11:59 AM, Charles Determan Jr deter...@umn.edu wrote: Greetings, I am currently exploring some capabilities of the 'Shiny' package. I am currently working with the most recent version of 'shiny' from the rstudio github repository (version - 0.10.1.9006) in order to use the most up to date datatables plugin. Using the ggplot2 diamonds dataset, I can easily set columns as unsearchable (commented out below) and I could also subset out all the 'Ideal' diamonds for example, however I cannot filter out multiple conditions such as 'Ideal' and 'Fair' diamonds together. From my searching, this multiple filtering can be done with checkboxes from the column using the jquery column filtering plugin ( http://jquery-datatables-column-filter.googlecode.com/svn/trunk/checkbox.html ). Despite this, I cannot get this plugin to work with my shiny app. Any insight would be appreciated. library(shiny) library(ggplot2) runApp( list(ui = basicPage( h1('Diamonds DataTable with TableTools'), # added column filter plugin singleton(tags$head(tags$script(src=' https://code.google.com/p/jquery-datatables-column-filter/source/browse/trunk/media/js/jquery.dataTables.columnFilter.js ', type='text/javascript'))), dataTableOutput(mytable) ) ,server = function(input, output) { output$mytable = renderDataTable({ diamonds[,1:6] }, options = list( pageLength = 10,# columnDefs = I('[{targets: [0,1], searchable: false}]') columnFilter = I('[{ columnDefs: [targets: [0,1], type: checkbox] }]') ) ) } )) Charles Charles -- Dr. Charles Determan, PhD Integrated Biosciences [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] shiny datatables column filtering plugin
It looks like a problem of DataTables -- I cannot find a way to specify the search.regex option for individual columns. You may ask this question on the DataTables forum. Basically I was expecting this to work: .DataTable({ search: { regex: true }, columnDefs: [{ search: { regex: true }, targets: [0, 1, 2, 3, 4] }] }) The global search box works, though. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Wed, Sep 3, 2014 at 2:09 PM, Charles Determan Jr deter...@umn.edu wrote: Thank you Yihui, this would certainly work for me however I have having trouble getting the regex to work appropriately. I am using the developmental version of shiny and have copied your code. I launch the app and the filtering of numbers works fine (i.e. 4,5) but the search for setosa and versicolor gives me a blank datatable. Is there some dependency that I am missing that would prevent this regex to work with shiny? On Wed, Sep 3, 2014 at 11:27 AM, Yihui Xie x...@yihui.name wrote: The built-in version of DataTables in shiny has already supported numeric ranges. For a numeric column x in data, if you type a,b in the search box, the data will be filtered using a = x = b. The check boxes are not supported, but you can use regular expressions (more flexible) to achieve the same thing, e.g. (this example requires the development version of shiny: https://groups.google.com/forum/#!topic/shiny-discuss/-0u-wTnq_lA) library(shiny) runApp(list( ui = fluidPage( dataTableOutput(mytable) ), server = function(input, output) { output$mytable = renderDataTable( iris[sample(nrow(iris)), ], options = list(search = list(regex = TRUE)) ) } )) Then you can search for ^setosa|versicolor$, which means both setosa and versicolor in the iris data. Or 4,5 in the search box of Sepal.Length to filter this column. Depending on what you want, this may or may not be enough. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Wed, Sep 3, 2014 at 7:12 AM, Charles Determan Jr deter...@umn.edu wrote: Thank you for checking Yihui, on the off chance are you familiar with any other methods to filter on multiple conditions? On Tue, Sep 2, 2014 at 11:07 PM, Yihui Xie x...@yihui.name wrote: I just tested it and this plugin does not seem to work with the new .DataTable() API in DataTables 1.10.x, so I guess it is unlikely to make it work in (the current development version of) shiny. It is not in the official list of plugins, either: http://www.datatables.net/extensions/index Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Tue, Sep 2, 2014 at 11:59 AM, Charles Determan Jr deter...@umn.edu wrote: Greetings, I am currently exploring some capabilities of the 'Shiny' package. I am currently working with the most recent version of 'shiny' from the rstudio github repository (version - 0.10.1.9006) in order to use the most up to date datatables plugin. Using the ggplot2 diamonds dataset, I can easily set columns as unsearchable (commented out below) and I could also subset out all the 'Ideal' diamonds for example, however I cannot filter out multiple conditions such as 'Ideal' and 'Fair' diamonds together. From my searching, this multiple filtering can be done with checkboxes from the column using the jquery column filtering plugin ( http://jquery-datatables-column-filter.googlecode.com/svn/trunk/checkbox.html). Despite this, I cannot get this plugin to work with my shiny app. Any insight would be appreciated. library(shiny) library(ggplot2) runApp( list(ui = basicPage( h1('Diamonds DataTable with TableTools'), # added column filter plugin singleton(tags$head(tags$script(src='https://code.google.com/p/jquery-datatables-column-filter/source/browse/trunk/media/js/jquery.dataTables.columnFilter.js', type='text/javascript'))), dataTableOutput(mytable) ) ,server = function(input, output) { output$mytable = renderDataTable({ diamonds[,1:6] }, options = list( pageLength = 10,# columnDefs = I('[{targets: [0,1], searchable: false}]') columnFilter = I('[{ columnDefs: [targets: [0,1], type: checkbox] }]') ) ) } )) Charles Charles -- Dr. Charles Determan, PhD Integrated Biosciences __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] shiny datatables column filtering plugin
Greetings, I am currently exploring some capabilities of the 'Shiny' package. I am currently working with the most recent version of 'shiny' from the rstudio github repository (version - 0.10.1.9006) in order to use the most up to date datatables plugin. Using the ggplot2 diamonds dataset, I can easily set columns as unsearchable (commented out below) and I could also subset out all the 'Ideal' diamonds for example, however I cannot filter out multiple conditions such as 'Ideal' and 'Fair' diamonds together. From my searching, this multiple filtering can be done with checkboxes from the column using the jquery column filtering plugin ( http://jquery-datatables-column-filter.googlecode.com/svn/trunk/checkbox.html). Despite this, I cannot get this plugin to work with my shiny app. Any insight would be appreciated. library(shiny) library(ggplot2) runApp( list(ui = basicPage( h1('Diamonds DataTable with TableTools'), # added column filter plugin singleton(tags$head(tags$script(src='https://code.google.com/p/jquery-datatables-column-filter/source/browse/trunk/media/js/jquery.dataTables.columnFilter.js', type='text/javascript'))), dataTableOutput(mytable) ) ,server = function(input, output) { output$mytable = renderDataTable({ diamonds[,1:6] }, options = list( pageLength = 10,# columnDefs = I('[{targets: [0,1], searchable: false}]') columnFilter = I('[{ columnDefs: [targets: [0,1], type: checkbox] }]') ) ) } )) Charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] shiny datatables column filtering plugin
I just tested it and this plugin does not seem to work with the new .DataTable() API in DataTables 1.10.x, so I guess it is unlikely to make it work in (the current development version of) shiny. It is not in the official list of plugins, either: http://www.datatables.net/extensions/index Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Tue, Sep 2, 2014 at 11:59 AM, Charles Determan Jr deter...@umn.edu wrote: Greetings, I am currently exploring some capabilities of the 'Shiny' package. I am currently working with the most recent version of 'shiny' from the rstudio github repository (version - 0.10.1.9006) in order to use the most up to date datatables plugin. Using the ggplot2 diamonds dataset, I can easily set columns as unsearchable (commented out below) and I could also subset out all the 'Ideal' diamonds for example, however I cannot filter out multiple conditions such as 'Ideal' and 'Fair' diamonds together. From my searching, this multiple filtering can be done with checkboxes from the column using the jquery column filtering plugin ( http://jquery-datatables-column-filter.googlecode.com/svn/trunk/checkbox.html). Despite this, I cannot get this plugin to work with my shiny app. Any insight would be appreciated. library(shiny) library(ggplot2) runApp( list(ui = basicPage( h1('Diamonds DataTable with TableTools'), # added column filter plugin singleton(tags$head(tags$script(src='https://code.google.com/p/jquery-datatables-column-filter/source/browse/trunk/media/js/jquery.dataTables.columnFilter.js', type='text/javascript'))), dataTableOutput(mytable) ) ,server = function(input, output) { output$mytable = renderDataTable({ diamonds[,1:6] }, options = list( pageLength = 10,# columnDefs = I('[{targets: [0,1], searchable: false}]') columnFilter = I('[{ columnDefs: [targets: [0,1], type: checkbox] }]') ) ) } )) Charles __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.