-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate_cmp_tbl.R
29 lines (26 loc) · 968 Bytes
/
generate_cmp_tbl.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#' Prepare compound table for interactive display
#'
#' This function modifies some of the columns in a compound table to be displayed better in an interactive table.
#' To the inchi column code to crop very long strings will be added.
#' To the name column "; " separater will be changed to a line break.
#' This is mainly used internally.
#'
#' @param cmp_tbl \code{\link{tibble}} of compounds.
#'
#' @return A \code{\link{tibble}} containing the same columns as the input table.
#'
#' @export
#'
#' @importFrom dplyr %>% mutate filter select
#' @importFrom magrittr %<>%
#'
#'
cmp_tbl_pretty <- function(cmp_tbl){
# make check happy
inchi <-
name <-
NULL
cmp_tbl %<>%
mutate(inchi = paste0('<div style= "-o-text-overflow: ellipsis; text-overflow: ellipsis; overflow:hidden; white-space:nowrap; width: 20em;">',inchi,'</div>')) %>%
mutate(name = gsub("; ","<br>",name))
}