Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ Imports:
openssl,
shiny,
shinycssloaders,
DBI,
DBI
Suggests:
duckdb
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export(gwalkr)
export(gwalkrOutput)
export(renderGwalkr)
import(DBI)
import(duckdb)
import(htmlwidgets)
import(openssl)
import(shiny)
Expand Down
1 change: 0 additions & 1 deletion R/duckdb_utils.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
library(DBI)
library(duckdb)

my_env <- new.env()

Expand Down
7 changes: 5 additions & 2 deletions R/gwalkr.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#' @import shiny
#' @import shinycssloaders
#' @import DBI
#' @import duckdb
#'
#' @param data A data frame to be visualized in the GWalkR. The data frame should not be empty.
#' @param lang A character string specifying the language for the widget. Possible values are "en" (default), "ja", "zh".
Expand All @@ -25,7 +24,7 @@
#' @param visConfig An optional config string to reproduce your chart. You can copy the string by clicking "export config" button on the GWalkR interface.
#' @param visConfigFile An optional config file path to reproduce your chart. You can download the file by clicking "export config" button then "download" button on the GWalkR interface.
#' @param toolbarExclude An optional list of strings to exclude the tools from toolbar UI. However, Kanaries brand info is not allowed to be removed or changed unless you are granted with special permission.
#' @param kernelComputation An optional boolean to enable the kernel mode computation which is much more efficient. Default is FALSE.
#' @param kernelComputation An optional boolean to enable the kernel mode computation which is much more efficient. Requires duckdb package installed. Default is FALSE.
#'
#' @return An \code{htmlwidget} object that can be rendered in R environments
#'
Expand All @@ -45,6 +44,10 @@ gwalkr <- function(data, lang = "en", dark = "light", columnSpecs = list(), visC
if (!is.null(visConfigFile)) {
visConfig <- readLines(visConfigFile, warn=FALSE)
}
if (kernelComputation && !requireNamespace("duckdb", quietly = TRUE)) {
warning("The 'duckdb' package is not installed. This feature will be disabled. Please install it with install.packages('duckdb').", call. = FALSE)
kernelComputation <- FALSE
}

if (kernelComputation) {
gwalkr_kernel(data, lang, dark, rawFields, visConfig, toolbarExclude)
Expand Down
2 changes: 1 addition & 1 deletion man/gwalkr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.