
Loved by learners at thousands of companies
Course Description
Importing data into R to start your analyses: it should be the easiest step. Unfortunately, this is almost never the case. Data can come in all sorts of formats, ranging from flat files and statistical software files to databases and web data. Knowing which approach to use is key to getting started with the actual analysis. In this course, you will learn all the basics on how to load data into R so you can get up and running in no time!
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.- 1
Importing data from flat files
FreeLots of data comes in the form of flat files: simple tabular text files. Learn how to import all common formats of flat file data with base R functions and the dedicated readr and data.table packages.
Introduction & Flat Files50 xpread.csv100 xpread.delim100 xpread.table100 xpstringsAsFactors100 xpAny changes?50 xpArguments100 xpColumn classes100 xpreadr & data.table50 xpread_delim100 xpread_csv100 xpcol_types, skip and n_max100 xpcol_types with collectors100 xpfread100 xpfread: more advanced use100 xpDedicated classes50 xp - 2
Importing data from Excel
FreeExcel is a very widely used data analysis tool. If you prefer to do your analyses in R, though, you'll need an understanding of importing CSV data into R. This chapter will explain you how to use readxl and gdata to do so. The XLConnect package that takes all of this one step further, will also be discussed.
The readxl package50 xpList the sheets of an Excel file100 xpImport an Excel sheet100 xpReading a workbook100 xpThe col_names argument100 xpThe skip argument100 xpThe gdata package50 xpImport a local file100 xpread.xls() wraps around read.table()100 xpWork that Excel data!100 xpThe XLConnect package50 xpImport a workbook100 xpList and read Excel sheets100 xpAdd and populate worksheets100 xp - 3
Importing data from other statistical software
FreeNext to R, there are also other commonly used statistical software packages: SAS, STATA and SPSS. Each of them has their own file format. Learn how to use the haven and foreign packages to get them into R with remarkable ease!
Importing data from other statistical software & haven50 xpImport SAS data with haven100 xpImport STATA data with haven100 xpWhat does the graphic tell?50 xpImport SPSS data with haven100 xpFactorize, round two100 xpThe foreign package50 xpImport STATA data with foreign (1)100 xpImport STATA data with foreign (2)100 xpDo you know your data?50 xpImport SPSS data with foreign (1)100 xpExcursion: Correlation50 xpImport SPSS data with foreign (2)100 xp - 4
Importing data from relational databases
FreeMany companies store their information in relational databases. The R community has also developed R packages to get data from these architectures. You'll learn how to connect to a database, how to retrieve data from it, and how to make things more efficient by performing a part of your computations on the database side.
Import from a relational database50 xpStep 1: Establish a connection100 xpStep 2: List the database tables100 xpStep 3: Import data from a table100 xpHow do the tables relate?50 xpSQL Queries from inside R50 xpYour very first SQL query100 xpMore advanced SQL queries100 xpJoin the query madness!50 xpSend - Fetch - Clear100 xpBe polite and ...100 xp - 5
Importing data from the web
FreeMore and more of the information that data scientists are using, resides on the web. Importing this data into R requires an understanding of protocols and typical data formats used on the web. In this chapter, you'll get a crash course in HTTP, learn to perform your own HTTP requests from inside R and get to know a popular web data format: JSON.
Importing data from the web50 xpImport flat files from the web100 xpSecure importing100 xpImport Excel files from the web100 xpDownloading any file, secure or not100 xpReading a text file from the web50 xpHTTP? httr! (1)100 xpHTTP? httr! (2)100 xpImporting data from the web: jsonlite50 xpFrom JSON to R100 xpFrom JSON to R (2)100 xpAsk OMDb100 xpFrom R to JSON100 xpMinify and prettify100 xp
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.
Data Science Instructor at DataCamp
Filip is the passionate developer behind several of DataCamp's most popular Python, SQL, and R courses. Filip led the development of DataLab, a collaborative data science notebook. Under the motto 'Eat your own dog food', he uses DataLab to understand how users learn on and interact with DataCamp. Filip holds degrees in Electrical Engineering and Artificial Intelligence.
Join over 16 million learners and start Importing Data Into R today!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.