pick: Choosing any rectangular data file using interactive GUI...

View source: R/pick.R

pickR Documentation

Choosing any rectangular data file using interactive GUI dialog box.

Description

You can alternatively use this function for choosing *.csv, *.csv2, *.tsv, *.txt, *.xls, *.xlsx, *.json, *.html, *.htm, *.php, *.pdf, *.doc, *.docx, *.rtf, *.RData, *.Rda, *.RDS, *.sav (SPSS), *.por, *.sas7bdat, *.sas7bcat, *.dta, *.xpt, *.mbox, and *.Rmd files in an interactive GUI mode A file choose dialog box will be prompted.

Usage

pick(file = NULL, mode = NULL, ...)

Arguments

file

Either a path to a file, a connection, or literal data (either a single string or a raw vector). The default is NULL, which pops up an interactive GUI file choose dialogue box for users unless an explicit path/to/filename is given. Each corresponding function depending upon a file extension will be automatically matched and applied once you pick up your file using either the GUI-file-chooser dialog box or explicit path/to/filename.

mode

Character value for session locale and encoding; available values are: "ko1" for "CP949"; "ko2" for "UTF-8" while both change R locale into Korean (default is the current locale and encoding of your R session).

...

Any additional arguments available for each file type and extension: vroom for 'CSV' (Comma-Separated Values); 'CSV2' (Semicolon-Separated Values); 'TSV' (Tab-Separated Values); 'txt' (plain text) files; read_excel for 'Excel' files; read_spss for 'SPSS' files; read_stata for 'Stata' files; read_sas for 'SAS' files; read_document for 'Microsoft Word', 'PDF', 'RTF', 'HTML', 'HTM', and 'PHP' files; fromJSON for 'JSON' files; read_mbox for 'mbox' files; render for 'Rmd' files; source for 'R' files; readRDS for 'RDS' files; load for 'RDA' and 'RDATA' files.

Details

pick

See example below.

Value

tibble (table data.frame) object of the chosen rectangular data file will be returned.

Author(s)

JooYoung Seo, jooyoung@psu.edu

Soyoung Choi, sxc940@psu.edu

See Also

picko for Korean users.

Examples

# Choosing file and saving it into a variable
## Scenario 1: Picking up a file using interactive GUI dialog box:
if (interactive()) {
  library(ezpickr)
  ## Use either `pick(mode="ko1")` or `pick(mode="ko2")` for Korean R users.
  data <- pick()
}

## Scenario 2: Picking up a file using an explicit file name ("test.sav" in the example below;
## however, you can feed other files through this function
## such as *.SAS, *.DTA, *.csv, *.csv2, *.tsv, *.xlsx, *.txt,
## *.html, webpage URL, *doc, *.docx, *.pdf, *.rtf, *.json, *.Rda, *.Rdata, and more):
library(ezpickr)
test <- system.file("extdata", "airquality.sav", package = "ezpickr")
## Use either `pick(test, mode="ko1")` or `pick(test, mode="ko2")` for Korean R users.
data <- pick(test)

# Now you can use the imported file as a tibble.
str(data)

jooyoungseo/ezpickR documentation built on Nov. 2, 2022, 11:20 p.m.