loading...

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()).

data_types(types_only = FALSE, view = TRUE)

Arguments

types_only

If TRUE, only a vector of types is returned, otherwise, a tibble 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.

Value

An tibble with types_only = FALSE, or a character vector.

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.

See also

Author

Philippe Grosjean phgrosjean@sciviews.org

Examples

if (FALSE) { # \dontrun{
data_types()
data_types(TRUE)
} # }
# For non-interactive use, specify view = FALSE
data_types(view = FALSE)
#> # A tibble: 44 × 5
#>    type     read_fun          read_header         write_fun              comment
#>    <chr>    <chr>             <chr>               <chr>                  <chr>  
#>  1 csv      data.table::fread data.io::hread_text data.table::fwrite     comma …
#>  2 csv_alt  readr::read_csv   data.io::hread_text readr::write_csv       comma …
#>  3 csv2     data.table::fread data.io::hread_text data.table::fwrite     semico…
#>  4 csv2_alt readr::read_csv2  data.io::hread_text NA                     semico…
#>  5 xlcsv    readr::read_csv   data.io::hread_text readr::write_excel_csv write …
#>  6 tsv      data.table::fread data.io::hread_text data.table::fwrite     tab se…
#>  7 tsv_alt  readr::read_tsv   data.io::hread_text readr::write_tsv       tab se…
#>  8 fwf      readr::read_fwf   data.io::hread_text NA                     fixed …
#>  9 log      readr::read_log   NA                  NA                     standa…
#> 10 rds      readr::read_rds   NA                  readr::write_rds       R data…
#> # ℹ 34 more rows
data_types(TRUE, view = FALSE)
#>  [1] "csv"          "csv_alt"      "csv2"         "csv2_alt"     "xlcsv"       
#>  [6] "tsv"          "tsv_alt"      "fwf"          "log"          "rds"         
#> [11] "txt"          "raw"          "ssv"          "ssv2"         "csv.gz"      
#> [16] "csv.gz_alt"   "csv2.gz"      "csv2.gz_alt"  "tsv.gz"       "tsv.gz_alt"  
#> [21] "txt.gz"       "csv.bz2"      "csv.bz2_alt"  "csv2.bz2"     "csv2.bz2_alt"
#> [26] "tsv.bz2"      "tsv.bz2_alt"  "txt.bz2"      "csv.xz"       "csv.xz_alt"  
#> [31] "csv2.xz"      "csv2.xz_alt"  "tsv.xz"       "tsv.xz_alt"   "txt.xz"      
#> [36] "xls"          "xlsx"         "dta"          "sas"          "sas7bdat"    
#> [41] "sav"          "zsav"         "por"          "xpt"