Choosing any rectangular data file using interactive GUI dialog box, and seamlessly manipulating tidy data between an 'Excel' window and R session.
The goal of ezpickr is to provide R beginners with a convenient way to
pick up their data files and to easily import it as a tidy tibble form
into an R environment using GUI file-picker dialogue box (through
ezpickr::pick()
), and to provide R users with a convenient way to open
and manipulate their data objects using Excel application for a seamless
data communication between an Excel window and R session through
ezpickr::viewxl()
).
You can alternatively use ezpickr::pick()
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, and *.mbox files in an interactive
GUI mode A file choose dialog box will be prompted.
Any additional arguments available for each file type and extension:
readr::read_csv()
for CSV (Comma-Separated Values) files;
readr::read_csv2()
for CSV2 (Semicolon-Separated Values) files;
readr::read_tsv()
for ‘TSV’ (Tab-Separated Values) files;
readr::read_file()
for ‘txt’ (plain text) files;
readxl::read_excel()
for ‘Excel’ files; haven::read_spss()
for
‘SPSS’ files; haven::read_stata()
for ‘Stata’ files;
haven::read_sas()
for ‘SAS’ files; textreadr::read_document()
for
‘Microsoft Word’, ‘PDF’, ‘RTF’, ‘HTML’, ‘HTM’, and ‘PHP’ files;
jsonlite::fromJSON()
for ‘JSON’ files; mboxr::read_mbox()
for ‘mbox’
files; base::readRDS()
for ‘RDS’ files; base::load()
for ‘RDA’ and
‘RDATA’ files.
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.
You can install the latest development version as follows:
if(!require(devtools)) {install.packages("devtools")}devtools::install_github('jooyoungseo/ezpickr')
You can install the released version of ezpickr from CRAN with:
install.packages("ezpickr")
pick()
FunctionThis is a basic example which shows you how to import data files:
library(ezpickr)# Choosing file and saving it into a variable## Scenario 1: Picking up a file using interactive GUI dialog box:data <- pick() ## Please use `picko()` instead if your path/file contains any Korean characters.## 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, *.json, *.Rda, *.Rdata, and more):data <- pick("test.sav") ## Please use `picko("test.sav")` instead if your path/file contains any Korean characters.# Now you can use the imported file as a tibble data frame.str(data)
viewxl()
FunctionYou can open any data.frame, tibble, matrix, table or vector from an R session into your default-set spreadsheet application window as follows:
library(ezpickr)data(airquality)str(airquality)# Use `viewxl()` function to open your data object in your spreadsheet:viewxl(airquality)# Then, when necessary, you can modify the opened data in the spreadsheet and save it as a new data.# You can pass a list object to the `viewxl()` function like below:l <- list(iris = iris, mtcars = mtcars, chickwts = chickwts, quakes = quakes)viewxl(l)# Then, each list item will appear in your Excel window sheet by sheet.
pick()
and picko()
functions now allow users to specify value-separator parameter using delim
option for *.csv
, *.csv2
, and *.tsv
files when the expected delimitters are not used. For example, in any event your csv file is separating each value using whitespace instead of comma(,) do the following:data <- pick(delim=" ")
pick()
function.viewxl()
function.readxl::read_excel()
for an Excel format within both pick()
and picko()
functions has been resolved; by default an Excel file with multiple sheets is returned as a list object when users have not passed any additional arguments.purrr
package has been added to the import package list to efficiently return multiple Excel sheets as a list of tibble; this way offers a better performance than the previous lapply()
mechanism.pick()
and picko()
functions.mode
option is specified in pick()
function has been resolved; Korean users now can use explicit Korean-included path/file in picko()
function as well.view()
function is now deprecated to avoid any collision with tibble::view()
function which has the same name; users is recommended to use viewxl()
function in the future instead.view()
and viewxl()
functions now return a tibble object reflecting users' real-time manipulation done in Excel.view()
and viewxl()
functions have been fixed to process multiple sheets as a list object.mbox
file format is now supported in both pick()
and picko()
functions using mboxr::read_mbox()
function under the hood.picko()
has been added to assist Korean R users in importing Korean-included path/to/file
as an alternative of pick()
function; other non-Korean R users can still employ the existing pick()
function.pick()
and picko()
functions now automatically return an Excel file that contains more than one sheet as a list of each Work Sheet (Thanks hyun seung Lee for the suggestion via email).view()
function now internally employs writexl::write_xlsx()
function instead of readr::write_csv()
to create Microsoft Excel file to provide users with a stable encoding consistency; since this change, mode
option of the view()
function has been removed.table
class is now supported in view()
function by automatically converting it into data.frame class.picko()
function when interacting with Korean-included dataset.mode
argument has been added to pick()
function to accommodate Korean R users' needs in terms of R session locale and encoding to Korean. Available values include "ko1" for "CP949" and "ko2" for "UTF-8" while both change R locale into Korean.view()
function has been newly added to provide R beginners with a convenient way to place their data in a spread sheet application.interactive()
condition is added to the pick()
example to avoid any error when called in a non-interactive testing environment.pick()
function.airquality.sav
for an example purpose.pick()
function returns a JSON file into a tibble form.pick()
function is applied.NEWS.md
file to track changes to the package.