mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-21 05:19:07 +02:00
internalised the create_column function from datamods for ui modifications - all variable icons are the same throughout now - added custom css
This commit is contained in:
parent
e3017458dd
commit
6a43ba7b5b
12 changed files with 1322 additions and 23 deletions
|
|
@ -318,9 +318,9 @@ class_icons <- function(x) {
|
|||
shiny::icon("arrow-down-a-z")
|
||||
} else if (identical(x, "logical")) {
|
||||
shiny::icon("toggle-off")
|
||||
} else if (any(c("Date", "POSIXct", "POSIXt") %in% x)) {
|
||||
} else if (any(c("Date", "POSIXt") %in% x)) {
|
||||
shiny::icon("calendar-days")
|
||||
} else if ("hms" %in% x) {
|
||||
} else if (any("POSIXct", "hms") %in% x) {
|
||||
shiny::icon("clock")
|
||||
} else {
|
||||
shiny::icon("table")
|
||||
|
|
@ -360,3 +360,33 @@ type_icons <- function(x) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#' Easily get variable icon based on data type or class
|
||||
#'
|
||||
#' @param data variable or data frame
|
||||
#' @param class.type "type" or "class". Default is "class"
|
||||
#'
|
||||
#' @returns svg icon
|
||||
#' @export
|
||||
#'
|
||||
#' @examples
|
||||
#' mtcars[1] |> get_var_icon("class")
|
||||
#' default_parsing(mtcars) |> get_var_icon()
|
||||
get_var_icon <- function(data,class.type=c("class","type")){
|
||||
if (is.data.frame(data)){
|
||||
lapply(data,get_var_icon)
|
||||
} else {
|
||||
|
||||
class.type <- match.arg(class.type)
|
||||
|
||||
switch(class.type,
|
||||
type = {
|
||||
type_icons(data_type(data))
|
||||
},
|
||||
class = {
|
||||
class(data)[1] |> class_icons()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue