You were: Stata download files with url query string
Stata download files with url query string | |
Stata download files with url query string | |
Stata download files with url query string | |
Stata download files with url query string |
Importing Data with RStudio
Introduction
Importing data into R is a necessary step that, at times, can become time intensive. To ease this task, RStudio includes new features to import data from: csv, xls, xlsx, sav, dta, por, sas and stata files.
Importing data
The data import features can be accessed from the environment pane or from the tools menu. The importers are grouped into 3 categories: Text data, Excel data and statistical data. To access this feature, use the "Import Dataset" dropdown from the "Environment" pane:
Or through the "File" menu, followed by the "Import Dataset" submenu:
Importing data from Text and CSV files
Importing "From Text (readr)" files allows you to import CSV files and in general, character delimited files using the readr package. This Text importer provides support to:
- Import from the file system or a url
- Change column data types
- Skip or include-only columns
- Rename the data set
- Skip the first N rows
- Use the header row for column names
- Trim spaces in names
- Change the column delimiter
- Encoding selection
- Select quote, escape, comment and NA identifiers
For example, one can import with ease a csv form diseinuak4web.net by pasting this url diseinuak4web.net?accessType=DOWNLOAD and selecting "Import".
Importing data from Text files
Importing using "From Text (base)" enables importing text files using the base package, this is helpful to preserve compatibility with previous versions of RStudio.
Importing data from Excel files
The Excel importer provides support to:
- Import from the file system or a url
- Change column data types
- Skip columns
- Rename the data set
- Select an specific Excel sheet
- Skip the first N rows
- Select NA identifiers
For example, one can import with ease an xls file from diseinuak4web.net by pasting this url diseinuak4web.net and selecting "Update".
Notice that this file contains to tables and therefore, requires the first few rows to be removed.
We can clean this up by skipping 6 rows from this file and unchecking the "First Row as Names" checkbox.
The file is looking better but some columns are being displayed as strings when they are clearly numerical data. We can fix this by selecting "numeric" from the column dropdown.
The final step is to click "Import" to run the code under "Code Preview" and import the data into RStudio, the final result should look as follows:
-
-