Added uiputfile
This commit is contained in:
parent
ce7fdeb003
commit
7a03f85190
3 changed files with 39 additions and 0 deletions
|
|
@ -28,5 +28,6 @@ export(strcmp)
|
|||
export(suoritaMuutos)
|
||||
export(times)
|
||||
export(uigetfile)
|
||||
export(uiputfile)
|
||||
importFrom(methods,is)
|
||||
importFrom(stats,runif)
|
||||
|
|
|
|||
21
R/uiputfile.R
Normal file
21
R/uiputfile.R
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#' @title Save file
|
||||
#' @param filter accepted file extension
|
||||
#' @param title Title
|
||||
#' @description This function intends to loosely mimic the behaviour of the
|
||||
#' homonymous Matlab function.
|
||||
#' @export
|
||||
uiputfile <- function(filter = ".rda", title = "Save file") {
|
||||
# ==========================================================================
|
||||
# Processing input
|
||||
# ==========================================================================
|
||||
message(title)
|
||||
filename <- readline(paste0('File name (end with ', filter, '): '))
|
||||
filepath <- readline(paste0('File path (leave empty for ', getwd(), '): '))
|
||||
if (filename == "") filename <- 0
|
||||
if (filepath == "") filepath <- getwd()
|
||||
# ==========================================================================
|
||||
# Processing output
|
||||
# ==========================================================================
|
||||
out <- list(name = filename, path = filepath)
|
||||
return(out)
|
||||
}
|
||||
17
man/uiputfile.Rd
Normal file
17
man/uiputfile.Rd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/uiputfile.R
|
||||
\name{uiputfile}
|
||||
\alias{uiputfile}
|
||||
\title{Save file}
|
||||
\usage{
|
||||
uiputfile(filter = ".rda", title = "Save file")
|
||||
}
|
||||
\arguments{
|
||||
\item{filter}{accepted file extension}
|
||||
|
||||
\item{title}{Title}
|
||||
}
|
||||
\description{
|
||||
This function intends to loosely mimic the behaviour of the
|
||||
homonymous Matlab function.
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue