Skip to content
Prev 6290 / 12125 Next

[R-pkg-devel] Having shiny as an optional dependency

On 16/11/2020 4:55 a.m., Kamil Stachowski wrote:
If you never call shinyjqui::sortableCheckboxGroupInput except in that 
one place, then you should put that call within the requireNamespace 
test.  Things I'd change there:

  - Do not use T, use TRUE.

  - Wrap *everything* that requires those packages in the 
requireNamespace test.

  - Make sure your example code in help pages never calls that function 
unless shiny and shinyjqui are present, by a test similar to the above 
but a positive one:

if (requireNamespace("shiny") && requireNamespace("shinyjqui")) {

    # example code

}

Duncan Murdoch