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
|
#' @description Loosely mimics the functionality of the `uigetfile` function on
|
||||||
#' Matlab.
|
#' Matlab.
|
||||||
#' @references https://se.mathworks.com/help/matlab/ref/uigetfile.html
|
#' @references https://se.mathworks.com/help/matlab/ref/uigetfile.html
|
||||||
|
#' @param filter Filter listed files
|
||||||
#' @param title Pre-prompt message
|
#' @param title Pre-prompt message
|
||||||
#' @export
|
#' @export
|
||||||
uigetfile <- function(title = "") {
|
uigetfile <- function(filter = "", title = "") {
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
# Pre-prompt message
|
# Pre-prompt message
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
|
|
@ -16,6 +17,11 @@ uigetfile <- function(title = "") {
|
||||||
paste0("Enter file path (leave empty for ", getwd(), "): ")
|
paste0("Enter file path (leave empty for ", getwd(), "): ")
|
||||||
)
|
)
|
||||||
if (filepath == "") filepath <- 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()
|
filename <- file.choose()
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
# Organizing output
|
# Organizing output
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,11 @@
|
||||||
\alias{uigetfile}
|
\alias{uigetfile}
|
||||||
\title{Select a file for loading}
|
\title{Select a file for loading}
|
||||||
\usage{
|
\usage{
|
||||||
uigetfile(title = "")
|
uigetfile(filter = "", title = "")
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
|
\item{filter}{Filter listed files}
|
||||||
|
|
||||||
\item{title}{Pre-prompt message}
|
\item{title}{Pre-prompt message}
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue