Reads a file from the Downloads directory and returns it as a data frame. The file type is automatically detected from the extension.
Usage
readDownload(file, ..., output = c("data.frame", "tibble"))Arguments
- file
character string specifying the name of the file.
- ...
additional arguments passed to the underlying read function, e.g.
sheetfor Excel files ordelimfor text files.- output
character, either
"data.frame"(default) or"tibble", determining the class of the returned object. Conversion todata.frameis done bytoBaseR(). The argument can be abbreviated. Note that it must be given as a named argument, as it follows the dots.
Details
This is a convenience wrapper combining findDownload() with
common file readers:
Excel files (
.xls,.xlsx) viareadxl::read_excelCSV files via
readr::read_csvTSV files via
readr::read_tsvText files (
.txt) viareadr::read_delim, which guesses the delimiter from the file content
For the readr-based formats the column specification message is
suppressed by default; supply show_col_types = TRUE to restore
it. By default, the result is converted to a base R data.frame.
See also
findDownload(),
toBaseR(), readxl::read_excel(),
readr::read_csv()
Other file.io:
parseSASDatalines(),
pdfManual(),
peekFile()
