File: util.R

package info (click to toggle)
r-cran-ggsignif 0.6.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 288 kB
  • sloc: sh: 13; makefile: 2
file content (11 lines) | stat: -rw-r--r-- 307 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11

# Copied from https://github.com/tidyverse/ggplot2/issues/2864
parse_safe <- function(text) {
  stopifnot(is.character(text))
  out <- vector("expression", length(text))
  for (i in seq_along(text)) {
    expr <- parse(text = text[[i]])
    out[[i]] <- if (length(expr) == 0) NA else expr[[1]]
  }
  out
}