Added listing of files
This commit is contained in:
parent
ee57a98589
commit
3962c8c0e8
2 changed files with 10 additions and 2 deletions
|
|
@ -2,9 +2,10 @@
|
|||
#' @description Loosely mimics the functionality of the `uigetfile` function on
|
||||
#' Matlab.
|
||||
#' @references https://se.mathworks.com/help/matlab/ref/uigetfile.html
|
||||
#' @param filter Filter listed files
|
||||
#' @param title Pre-prompt message
|
||||
#' @export
|
||||
uigetfile <- function(title = "") {
|
||||
uigetfile <- function(filter = "", title = "") {
|
||||
# ==========================================================================
|
||||
# Pre-prompt message
|
||||
# ==========================================================================
|
||||
|
|
@ -16,6 +17,11 @@ uigetfile <- function(title = "") {
|
|||
paste0("Enter file path (leave empty for ", getwd(), "): ")
|
||||
)
|
||||
if (filepath == "") filepath <- getwd()
|
||||
# ==========================================================================
|
||||
# Presenting possible files
|
||||
# ==========================================================================
|
||||
message("Files present on that directory:")
|
||||
print(list.files(path = filepath, pattern = filter, ignore.case = TRUE))
|
||||
filename <- file.choose()
|
||||
# ==========================================================================
|
||||
# Organizing output
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
\alias{uigetfile}
|
||||
\title{Select a file for loading}
|
||||
\usage{
|
||||
uigetfile(title = "")
|
||||
uigetfile(filter = "", title = "")
|
||||
}
|
||||
\arguments{
|
||||
\item{filter}{Filter listed files}
|
||||
|
||||
\item{title}{Pre-prompt message}
|
||||
}
|
||||
\description{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue