Import Rostido Bank Account Transaction Data
Import_Rostido.Rd
Functions to facilitate reading CSV transaction files downloaded from the Rostido website.
rostido_fname()
returns the name of a Rostido Bank CSV format transactions file as a character
string.
most_recent_fname()
finds the Rostido Bank CSV format transactions file incorporating the most recent date
within its name among those in a specified folder.
read_rostido_csv()
reads a CSV format transactions file downloaded from the Rostido website and returns the
contents as a data frame.
Arguments
- .date
Date
object, the date to be incorporated into a filename string.- filepath
character
string, the path to a folder in which to conduct the file search; defaultNULL
.- trydate
Date
object, the most recent date within the file name from which to start the search; defaultSys.Date()
.- earliest
Date
object, the earliest date within the file name beyond which the search is discontinued; defaultas.Date("2024-02-01")
.- fun
function
, used to incorporate.date
into a filename search string; defaultrostido_fname
.- filename
character
string, the name of a CSV file to be read.
Value
rostido_fname()
A
character
string representing a filename incorporating a date, of the form"Downloadyyyymmdd.csv"
, with attributes"date"
, a"Date"
object, and"filepath"
, corresponding to the argument of the same name (if supplied).most_recent_fname()
An object comprising a
character
string representing a filename incorporating a date as specified infun
.read_rostido_csv()
CSV transaction file data formatted by Rostido Bank, as a dataframe.
Details
rostido_fname()
returns a character
string representing the name of a CSV format transactions file downloaded
from the Rostido website by concatenating the strings "Download"
, a date of the form "yyyymmdd"
and the
extension ".csv"
e.g., "Download20240401.csv"
most_recent_fname()
searches the current folder or a folder specified using filepath
for a filename
incorporating a date specified by the .date
argument, typically the current date obtained using the default
Sys.Date()
. The filename incorporates the date as specified by fun
, typically the default
rostido_fname()
as above. If no such file exists, filenames incorporating earlier dates are searched for
successively until either a corresponding file is found or the search is discontinued upon reaching the date
specified in the earliest
argument.
read_rostido_csv()
reads a transactions CSV file as downloaded from the Rostido website using
read.csv()
and returns the contents as a data frame. The file to be read is specified in the
filename
argument and is located in the folder specified in that argument's "filepath"
attribute if it has one,
otherwise in the current working directory.
See also
as.Date()
, read.csv()
, Sys.Date()
.
Other Rostido:
Manage_Rostido
Examples
dnldpath <- "~/Rostido Bank/Downloads"
rostido_fname(Sys.Date())
#> [1] "Download20241024.csv"
#> attr(,"date")
#> [1] "2024-10-24"
## __________________________
## Current account 55545372
rostido_fname(Sys.Date(), file.path(dnldpath, 55545372))
#> [1] "Download20241024.csv"
#> attr(,"date")
#> [1] "2024-10-24"
#> attr(,"filepath")
#> [1] "~/Rostido Bank/Downloads/55545372"
if (FALSE) { # \dontrun{
(file.path(dnldpath, 55545372) |>
most_recent_fname() |>
read_rostido_csv())
} # }
## __________________________
## Savings account 55596784
rostido_fname(Sys.Date(), file.path(dnldpath, 55596784))
#> [1] "Download20241024.csv"
#> attr(,"date")
#> [1] "2024-10-24"
#> attr(,"filepath")
#> [1] "~/Rostido Bank/Downloads/55596784"
if (FALSE) { # \dontrun{
(savacc <- file.path(dnldpath, 55596784) |>
most_recent_fname() |>
read_rostido_csv())
} # }