R/drc_labels.R

Defines functions drc_labels

#' Generate pretty labels for drc plot
#'
#' @param model results from drc_fit
#'
#' @return a list of labels suitable for ggPlot legend
#' @export
#'
#' @examples
drc_labels<-function(model, sep=":", unit="µM"){
  model %>% drc_table( ) %>% purrr::pmap( ~bquote(
    .(..1) ~ .(sep)  ~ .(..3) ~ .(unit)
  ))
}

# drc_labels<-function(model){
#   model%>% unnest(coefs) %>% filter(names == "IC50:(Intercept)") -> IC50values
#   lapply(1:nrow(IC50values),
#          function(x){
#            as.expression(bquote(
#              .(as.character(IC50values[x,]$compound)) ~
#                IC[50]: ~
#                .(format(IC50values[x,]$x, digits=3)) ~
#                "µM"
#            ))
#
#          })
# }
tdanker/ephys2 documentation built on Aug. 11, 2019, 12:12 p.m.