R/folder_choose.R

Defines functions folder.choose

Documented in folder.choose

#' Choose a folder interactively
#'
#' @description Choose a folder interactively by choosing a file in that folder.
#' @return A character vector of length one giving the folder path.
#' @export
folder.choose <- function()
  {
  cat("Please choose a file in the folder.\n")
  file = base::file.choose()
if(.Platform$OS.type=="windows")
{
  f = unlist(gregexpr("\\\\",file))
  folder = substr(file,1,f[length(f)]-1)
}
else
{
  f = unlist(gregexpr("/",file))
  folder = substr(file,1,f[length(f)]-1)
}
  return(folder)
}

Try the bioimagetools package in your browser

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

bioimagetools documentation built on May 28, 2022, 5:06 p.m.