Import - Export app guide

 

 

Introduction

 

The aim of this shiny app is to provide a simple way to convert (import and export) data sets between the most common formats such as plain text (.txt, .csv), SPSS (.sav) or Excel (.xlsx, .xls) keeping the user to having to search the most appropiate R function or tool in each case. Also, the implemented functions guarantee the least loss of the data information, giving special attention to the date variables and the labelled ones.

 

This app also offers multiple ways to check the database making easier to find out any potential problem during the import / export process.

 

The user must follow three steps in order to complete all the process and receive the data set in the desired extension. But, before introducing each step, we will see the structure of the app.

 

App form structure

 

The form of this app is divided into two panels:

 

Step1) Format detection + import

 

In this first step we need to select the file (maybe placed locally in our computer) containing the database we want to convert. Once the file is selected, if we still have the "file" panel open in the right section we will see the format that has been automatically detected. Then, we can see a selected checkbox that assumes the format is correct. If not, we can unselect it and choose the right format.

 

When we have the selected file with its appropriate format we will see a button labelled "Show import options" which will display a pop-up containing mandatory and optional options to perform the import process. The pop-ups may also contain a link to the description of the used R function.

 

Finally, we can close the pop-up, press the import button and go to the next step.

 

 

Step2) Database checkup

 

 

Even though this step has few options in the scroll panel, the most important elements are at the right panel.

 

In the scroll panel we can see a checkbox to run format_corrector (a function to fix some format problems, detailed in the help link from above) and a list with the variables stored in the dataset. We can select which of these variables we want to keep.

 

In the right panel we can see four tabs with relevant information of the dataset.

 

 

 

Step3) Export

 

This is the last step and is pretty similar to the first one. The first list allows us to select the format we want. Similar to the first step, each format will have different options, and most of them will have an "export options" button which will display a pop-up with more options.

 

Most of the formats can be just downloaded using the "download" button, but there are special formats like Microsoft Access or SPSS which will be downloaded in a different way:

 

 

Import and export R functions

 

Import:

 

File format Function Description
Plain text (.txt, .csv) table_import Created function that calls read.table and automatically detects the field separator.
Excel (.xls, .xlsx) read_excel Function from the readxl package. It can read both .xls and .xlsx.
SPSS (.sav) spss_import Created function that calls spss.get from Hmisc package and detects date variables automatically.
Microsoft Acces (.mdb) access_import Created function that simplifies the RODBC package functions to read from Access in a rather simple way.
Stata (.dta) read_dta Function from haven package.
SAS read_sas, read.xport Function from the foreign and haven package respectively, depending on the data extension we will need one or another.

 

Export

 

File format Function Description
Plain text (.txt) write.table Function from R base package.
Plain text (.csv) write.csv Function from R base package to export data to comma or semicolon separated variables.
Excel (.xls, .xlsx) excel_export Created function that calls write_xlsx from writexl package. It can write to multiple sheets.
SPSS (.sav) spss_export Created function that builds the SPSS file by executing SPSS software (or alternatively PSPP) from generated plain text data and code files.
Microsoft Acces (.mdb) access_export Created function that simplifies the RODBC package functions to write ACCESS tables in a rather simple way.
Stata (.dta) write_dta Function from haven package.
SAS write, read.xport Function from foreign package.