From bc56a8841d51a2df4755c13c34544336c4108e23 Mon Sep 17 00:00:00 2001 From: jschelfhout Date: Fri, 26 Sep 2025 11:31:03 +0200 Subject: [PATCH 1/2] Add more information regarding packages implementing dplyr methods. --- editbl/R/eDT.R | 4 ++- editbl/R/utils.R | 1 + editbl/man/eDT.Rd | 33 +++++++++------------- editbl/man/standardizeArgument_colnames.Rd | 8 +++--- editbl/man/standardizeArgument_editable.Rd | 13 ++++----- 5 files changed, 28 insertions(+), 31 deletions(-) diff --git a/editbl/R/eDT.R b/editbl/R/eDT.R index 2ad5273..5f7678e 100644 --- a/editbl/R/eDT.R +++ b/editbl/R/eDT.R @@ -58,7 +58,9 @@ eDTOutput <- function(id,...) { #' @details All arguments except 'id' and 'env' can be normal objects or reactive objects. #' #' @param id `character(1)` module id -#' @param data `tbl`. The function will automatically cast to tbl if needed. +#' @param data `tbl`. When using non-standard tibble objects as input, install the corresponding dplyr implementation. +#' (`data.table` = dtplyr, spark = sparklyr, generic database = dbplyr,...). +#' The function will try to automatically cast to `tbl` if required, though it is recommended cast explicitly. #' @inheritParams DT::datatable #' @param keys `character`. Defaults to all columns under the assumption that at least every row is unique. #' @param format function accepting and returning a \code{\link[DT]{datatable}} diff --git a/editbl/R/utils.R b/editbl/R/utils.R index b1bc3fd..2d0a1ba 100644 --- a/editbl/R/utils.R +++ b/editbl/R/utils.R @@ -126,6 +126,7 @@ castToTbl <- function(data){ if(dplyr::is.tbl(data)){ result <- data } else if(inherits(data, 'data.table')){ + requireNamespace('dtplyr') result <- dtplyr::lazy_dt(data) } else { result <- dplyr::as_tibble(data) diff --git a/editbl/man/eDT.Rd b/editbl/man/eDT.Rd index 6c87259..2245a13 100644 --- a/editbl/man/eDT.Rd +++ b/editbl/man/eDT.Rd @@ -46,13 +46,15 @@ eDT( ) } \arguments{ -\item{data}{\code{tbl}. The function will automatically cast to tbl if needed.} +\item{data}{\code{tbl}. When using non-standard tibble objects as input, install the corresponding dplyr implementation. +(\code{data.table} = dtplyr, spark = sparklyr, generic database = dbplyr,...). +The function will try to automatically cast to \code{tbl} if required, though it is recommended cast explicitly.} \item{options}{a list of initialization options (see \url{https://datatables.net/reference/option/}); the character options -wrapped in \code{\link[htmlwidgets]{JS}()} will be treated as literal +wrapped in \code{\link[htmlwidgets:JS]{htmlwidgets::JS()}} will be treated as literal JavaScript code instead of normal character strings; you can also set -options globally via \code{\link{options}(DT.options = list(...))}, and +options globally via \verb{[options](DT.options = list(...))}, and global options will be merged into this \code{options} argument if set} \item{class}{the CSS class(es) of the table; see @@ -68,9 +70,7 @@ in the first column of the table if exist (not \code{NULL})} \item{colnames}{if missing, the column names of the data; otherwise it can be an unnamed character vector of names you want to show in the table header instead of the default data column names; alternatively, you can provide a -\emph{named} numeric or character vector of the form \code{'newName1' = i1, -'newName2' = i2} or \code{c('newName1' = 'oldName1', 'newName2' = -'oldName2', ...)}, where \code{newName} is the new name you want to show in +\emph{named} numeric or character vector of the form \verb{'newName1' = i1, 'newName2' = i2} or \code{c('newName1' = 'oldName1', 'newName2' = 'oldName2', ...)}, where \code{newName} is the new name you want to show in the table, and \code{i} or \code{oldName} is the index of the current column name} @@ -98,15 +98,14 @@ the first column to display, you should add the numeric column indices by one when using \code{rownames}} \item{style}{either \code{'auto'}, \code{'default'}, \code{'bootstrap'}, or -\code{'bootstrap4'}. If \code{'auto'}, and a **bslib** theme is +\code{'bootstrap4'}. If \code{'auto'}, and a \strong{bslib} theme is currently active, then bootstrap styling is used in a way that "just works" for the active theme. Otherwise, -\href{https://datatables.net/manual/styling/classes}{DataTables -\code{'default'} styling} is used. If set explicitly to \code{'bootstrap'} +\href{https://datatables.net/manual/styling/classes}{DataTables \code{'default'} styling} is used. If set explicitly to \code{'bootstrap'} or \code{'bootstrap4'}, one must take care to ensure Bootstrap's HTML dependencies (as well as Bootswatch themes, if desired) are included on the page. Note, when set explicitly, it's the user's responsibility to ensure -that only one unique `style` value is used on the same page, if multiple +that only one unique \code{style} value is used on the same page, if multiple DT tables exist, as different styling resources may conflict with each other.} \item{width, height}{Width/Height in pixels (optional, defaults to automatic @@ -121,12 +120,11 @@ then vertical and/or horizontal scrolling of the table cells will occur.} \item{autoHideNavigation}{\code{TRUE} to automatically hide navigational UI (only display the table body) when the number of total records is less than the page size. Note, it only works on the client-side processing mode -and the `pageLength` option should be provided explicitly.} +and the \code{pageLength} option should be provided explicitly.} \item{selection}{the row/column selection mode (single or multiple selection or disable selection) when a table widget is rendered in a Shiny app; -alternatively, you can use a list of the form \code{list(mode = 'multiple', -selected = c(1, 3, 8), target = 'row', selectable = c(-2, -3))} to +alternatively, you can use a list of the form \code{list(mode = 'multiple', selected = c(1, 3, 8), target = 'row', selectable = c(-2, -3))} to pre-select rows and control the selectable range; the element \code{target} in the list can be \code{'column'} to enable column selection, or \code{'row+column'} to make it possible to select both rows @@ -146,13 +144,11 @@ the available plugins by calling \code{DT:::available_plugins()}} it to \code{"row"} to be able to edit a row, or \code{"column"} to edit a column, or \code{"all"} to edit all cells on the current page of the table. In all modes, start editing by doubleclicking on a cell. This argument can -also be a list of the form \code{list(target = TARGET, disable = -list(columns = INDICES))}, where \code{TARGET} can be \code{"cell"}, +also be a list of the form \code{list(target = TARGET, disable = list(columns = INDICES))}, where \code{TARGET} can be \code{"cell"}, \code{"row"}, \code{"column"}, or \code{"all"}, and \code{INDICES} is an integer vector of column indices. Use the list form if you want to disable editing certain columns. You can also restrict the editing to accept only -numbers by setting this argument to a list of the form \code{list(target = -TARGET, numeric = INDICES)} where \code{INDICES} can be the vector of the +numbers by setting this argument to a list of the form \code{list(target = TARGET, numeric = INDICES)} where \code{INDICES} can be the vector of the indices of the columns for which you want to restrict the editing to numbers or \code{"all"} to restrict the editing to numbers for all columns. If you don't set \code{numeric}, then the editing is restricted to numbers @@ -164,8 +160,7 @@ list of the form \code{list(target = TARGET, area = INDICES)} where you want the text areas, or \code{"all"} if you want the text areas for all columns. Of course, you can request the numeric editing for some columns and the text areas for some other columns by setting -\code{editable} to a list of the form \code{list(target = TARGET, numeric -= INDICES1, area = INDICES2)}. Finally, you can edit date cells with a +\code{editable} to a list of the form \code{list(target = TARGET, numeric = INDICES1, area = INDICES2)}. Finally, you can edit date cells with a calendar with \code{list(target = TARGET, date = INDICES)}; the target columns must have the \code{Date} type. If you don't set \code{date} in the \code{editable} list, the editing with the calendar is automatically diff --git a/editbl/man/standardizeArgument_colnames.Rd b/editbl/man/standardizeArgument_colnames.Rd index 8493b31..cd89af8 100644 --- a/editbl/man/standardizeArgument_colnames.Rd +++ b/editbl/man/standardizeArgument_colnames.Rd @@ -10,13 +10,13 @@ standardizeArgument_colnames(colnames, data) \item{colnames}{if missing, the column names of the data; otherwise it can be an unnamed character vector of names you want to show in the table header instead of the default data column names; alternatively, you can provide a -\emph{named} numeric or character vector of the form \code{'newName1' = i1, -'newName2' = i2} or \code{c('newName1' = 'oldName1', 'newName2' = -'oldName2', ...)}, where \code{newName} is the new name you want to show in +\emph{named} numeric or character vector of the form \verb{'newName1' = i1, 'newName2' = i2} or \code{c('newName1' = 'oldName1', 'newName2' = 'oldName2', ...)}, where \code{newName} is the new name you want to show in the table, and \code{i} or \code{oldName} is the index of the current column name} -\item{data}{\code{tbl}. The function will automatically cast to tbl if needed.} +\item{data}{\code{tbl}. When using non-standard tibble objects as input, install the corresponding dplyr implementation. +(\code{data.table} = dtplyr, spark = sparklyr, generic database = dbplyr,...). +The function will try to automatically cast to \code{tbl} if required, though it is recommended cast explicitly.} } \value{ named character vector diff --git a/editbl/man/standardizeArgument_editable.Rd b/editbl/man/standardizeArgument_editable.Rd index d8a69c3..e270977 100644 --- a/editbl/man/standardizeArgument_editable.Rd +++ b/editbl/man/standardizeArgument_editable.Rd @@ -12,13 +12,11 @@ standardizeArgument_editable(editable, data) it to \code{"row"} to be able to edit a row, or \code{"column"} to edit a column, or \code{"all"} to edit all cells on the current page of the table. In all modes, start editing by doubleclicking on a cell. This argument can -also be a list of the form \code{list(target = TARGET, disable = -list(columns = INDICES))}, where \code{TARGET} can be \code{"cell"}, +also be a list of the form \code{list(target = TARGET, disable = list(columns = INDICES))}, where \code{TARGET} can be \code{"cell"}, \code{"row"}, \code{"column"}, or \code{"all"}, and \code{INDICES} is an integer vector of column indices. Use the list form if you want to disable editing certain columns. You can also restrict the editing to accept only -numbers by setting this argument to a list of the form \code{list(target = -TARGET, numeric = INDICES)} where \code{INDICES} can be the vector of the +numbers by setting this argument to a list of the form \code{list(target = TARGET, numeric = INDICES)} where \code{INDICES} can be the vector of the indices of the columns for which you want to restrict the editing to numbers or \code{"all"} to restrict the editing to numbers for all columns. If you don't set \code{numeric}, then the editing is restricted to numbers @@ -30,14 +28,15 @@ list of the form \code{list(target = TARGET, area = INDICES)} where you want the text areas, or \code{"all"} if you want the text areas for all columns. Of course, you can request the numeric editing for some columns and the text areas for some other columns by setting -\code{editable} to a list of the form \code{list(target = TARGET, numeric -= INDICES1, area = INDICES2)}. Finally, you can edit date cells with a +\code{editable} to a list of the form \code{list(target = TARGET, numeric = INDICES1, area = INDICES2)}. Finally, you can edit date cells with a calendar with \code{list(target = TARGET, date = INDICES)}; the target columns must have the \code{Date} type. If you don't set \code{date} in the \code{editable} list, the editing with the calendar is automatically set for all \code{Date} columns.} -\item{data}{\code{tbl}. The function will automatically cast to tbl if needed.} +\item{data}{\code{tbl}. When using non-standard tibble objects as input, install the corresponding dplyr implementation. +(\code{data.table} = dtplyr, spark = sparklyr, generic database = dbplyr,...). +The function will try to automatically cast to \code{tbl} if required, though it is recommended cast explicitly.} } \value{ list of the form \code{list(target = foo, ...)} From cb3a407e13cd075cca8d903ee9ba4bfc4a6d58c6 Mon Sep 17 00:00:00 2001 From: jschelfhout Date: Fri, 26 Sep 2025 14:31:41 +0200 Subject: [PATCH 2/2] Reword --- editbl/R/eDT.R | 6 +++--- editbl/man/eDT.Rd | 6 +++--- editbl/man/standardizeArgument_colnames.Rd | 6 +++--- editbl/man/standardizeArgument_editable.Rd | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/editbl/R/eDT.R b/editbl/R/eDT.R index 5f7678e..50f19ab 100644 --- a/editbl/R/eDT.R +++ b/editbl/R/eDT.R @@ -58,9 +58,9 @@ eDTOutput <- function(id,...) { #' @details All arguments except 'id' and 'env' can be normal objects or reactive objects. #' #' @param id `character(1)` module id -#' @param data `tbl`. When using non-standard tibble objects as input, install the corresponding dplyr implementation. -#' (`data.table` = dtplyr, spark = sparklyr, generic database = dbplyr,...). -#' The function will try to automatically cast to `tbl` if required, though it is recommended cast explicitly. +#' @param data `tbl`. When using non-standard tibble objects, install the required package implementing specific methods. +#' (`data.table`: dtplyr, spark: sparklyr, generic database: dbplyr,...). +#' While other tabular objects like `data.frame` are supported, explicitly casting to `tbl` is recommended. #' @inheritParams DT::datatable #' @param keys `character`. Defaults to all columns under the assumption that at least every row is unique. #' @param format function accepting and returning a \code{\link[DT]{datatable}} diff --git a/editbl/man/eDT.Rd b/editbl/man/eDT.Rd index 2245a13..0e1725c 100644 --- a/editbl/man/eDT.Rd +++ b/editbl/man/eDT.Rd @@ -46,9 +46,9 @@ eDT( ) } \arguments{ -\item{data}{\code{tbl}. When using non-standard tibble objects as input, install the corresponding dplyr implementation. -(\code{data.table} = dtplyr, spark = sparklyr, generic database = dbplyr,...). -The function will try to automatically cast to \code{tbl} if required, though it is recommended cast explicitly.} +\item{data}{\code{tbl}. When using non-standard tibble objects, install the required package implementing specific methods. +(\code{data.table}: dtplyr, spark: sparklyr, generic database: dbplyr,...). +While other tabular objects like \code{data.frame} are supported, explicitly casting to \code{tbl} is recommended.} \item{options}{a list of initialization options (see \url{https://datatables.net/reference/option/}); the character options diff --git a/editbl/man/standardizeArgument_colnames.Rd b/editbl/man/standardizeArgument_colnames.Rd index cd89af8..b33f3d9 100644 --- a/editbl/man/standardizeArgument_colnames.Rd +++ b/editbl/man/standardizeArgument_colnames.Rd @@ -14,9 +14,9 @@ instead of the default data column names; alternatively, you can provide a the table, and \code{i} or \code{oldName} is the index of the current column name} -\item{data}{\code{tbl}. When using non-standard tibble objects as input, install the corresponding dplyr implementation. -(\code{data.table} = dtplyr, spark = sparklyr, generic database = dbplyr,...). -The function will try to automatically cast to \code{tbl} if required, though it is recommended cast explicitly.} +\item{data}{\code{tbl}. When using non-standard tibble objects, install the required package implementing specific methods. +(\code{data.table}: dtplyr, spark: sparklyr, generic database: dbplyr,...). +While other tabular objects like \code{data.frame} are supported, explicitly casting to \code{tbl} is recommended.} } \value{ named character vector diff --git a/editbl/man/standardizeArgument_editable.Rd b/editbl/man/standardizeArgument_editable.Rd index e270977..a9cf2af 100644 --- a/editbl/man/standardizeArgument_editable.Rd +++ b/editbl/man/standardizeArgument_editable.Rd @@ -34,9 +34,9 @@ columns must have the \code{Date} type. If you don't set \code{date} in the \code{editable} list, the editing with the calendar is automatically set for all \code{Date} columns.} -\item{data}{\code{tbl}. When using non-standard tibble objects as input, install the corresponding dplyr implementation. -(\code{data.table} = dtplyr, spark = sparklyr, generic database = dbplyr,...). -The function will try to automatically cast to \code{tbl} if required, though it is recommended cast explicitly.} +\item{data}{\code{tbl}. When using non-standard tibble objects, install the required package implementing specific methods. +(\code{data.table}: dtplyr, spark: sparklyr, generic database: dbplyr,...). +While other tabular objects like \code{data.frame} are supported, explicitly casting to \code{tbl} is recommended.} } \value{ list of the form \code{list(target = foo, ...)}