Display information about data types that can read() and write() can use, as well as, the original functions that are delegated (see they respective help pages for more info and to know which additional parameters can be used in read() and write()).
Arguments
- types_only
If
TRUE
, only a vector of types is returned, otherwise, atibble
with full specifications is provided.- view
If
TRUE
, the result is "viewed" (displayed in a table in a separate window, if the user interface allows it, e.g., in RStudio) and returned invisibly. Otherwise, the results are returned normally.
Details
The function is mainly designed to be used interactively and to
provide information about file types that can be read() or write(). This
cannot be done through a man page because this list is dynamic and other
packages could add or change entries there. With view = FALSE
, the function
can, nevertheless, be also used in a script or a R Markdown/Notebook
document.
Author
Philippe Grosjean phgrosjean@sciviews.org
Examples
if (FALSE) {
data_types()
data_types(TRUE)
}
# For non-interactive use, specify view = FALSE
data_types(view = FALSE)
#> # A tibble: 32 × 5
#> type read_fun read_header write_fun comment
#> <chr> <chr> <chr> <chr> <chr>
#> 1 csv readr::read_csv data.io::hread_text readr::write_csv comma …
#> 2 csv2 readr::read_csv2 data.io::hread_text NA semico…
#> 3 xlcsv readr::read_csv data.io::hread_text readr::write_excel_csv write …
#> 4 tsv readr::read_tsv data.io::hread_text readr::write_tsv tab se…
#> 5 fwf readr::read_fwf data.io::hread_text NA fixed …
#> 6 log readr::read_log NA NA standa…
#> 7 rds readr::read_rds NA readr::write_rds R data…
#> 8 txt readr::read_file NA readr::write_file text f…
#> 9 raw readr::read_file_raw NA NA binary…
#> 10 ssv readr::read_table data.io::hread_text NA space …
#> # ℹ 22 more rows
data_types(TRUE, view = FALSE)
#> [1] "csv" "csv2" "xlcsv" "tsv" "fwf" "log"
#> [7] "rds" "txt" "raw" "ssv" "ssv2" "csv.gz"
#> [13] "csv2.gz" "tsv.gz" "txt.gz" "csv.bz2" "csv2.bz2" "tsv.bz2"
#> [19] "txt.bz2" "csv.xz" "csv2.xz" "tsv.xz" "txt.xz" "xls"
#> [25] "xlsx" "dta" "sas" "sas7bdat" "sav" "zsav"
#> [31] "por" "xpt"