R/name.R

Defines functions name

name <- function(name, path) {
  path <- basename(path)

  if (identical(name, "")) {
    return(path)
  }

  if (grepl("[.]", name)) {
    err("Name '", name, "' must not include an extension.",
      .subclass = "flobr_error"
    )
  }

  p0(name, ".", tools::file_ext(path))
}

Try the flobr package in your browser

Any scripts or data that you put into this service are public.

flobr documentation built on Aug. 25, 2022, 5:05 p.m.