Center for Customer Insights and Digital Marketing

R Workshop #3: Data Input and Output

Data Input and Output

Jarrod Griffin, Junior Marketing Scientist at the Center for Customer Insights and Digital Marketing, explains how to use the built-in datasets in R, import various data files, scrape data from the web, save data to other file format (i.e., csv, xlsx, spss), and why Git and GitHub are important tools to expand your capability.

If you haven't installed R or RStudio, click here to learn how!

Learning Outcomes

1. Explain how to create a Github repository and collaborate with others on the same R projects.
2. Effectively load and look through built-in datasets in R.
3. Import various type of data (csv, xlsx, and SPSS) to RStudio.
4. Scrape data from the web using SelectorGadget and rvest.
5. Export/save output data to local pc and push to Github.

Check below to view the video!

Relevant Links and Code:

Workshop 3 Data GitHub: https://github.com/jsgriffin96/r_workshop_3_data 

Stocks: https://finance.yahoo.com/quote/dis/history?ltr=1 

IMDB: https://www.imdb.com/chart/bottom?pf_rd_m=A2FGELUUNOQJNL&pf_rd_p=4da9d9a5-d299-43f2-9c53-f0efa18182cd&pf_rd_r=Z2TFMCSJZQMJS52FPA69&pf_rd_s=right-4&pf_rd_t=15506&pf_rd_i=moviemeter&ref_=chtmvm_ql_8 

Selector Gadget: https://chrome.google.com/webstore/detail/selectorgadget/mhjhnkcfbdhnjickkkdbjoemdmbfginb 

Supplementary Video on How to Link RStudio and Github: https://www.youtube.com/watch?v=ssEYd8T07y4&feature=youtu.be

 

install.packages('foreign')

install.packages("haven")

install.packages('rvest')

install.packages('tidyverse')

install.packages('readxl')

install.packages('readr')

install.packages('xlsx')

library('foreign')

library('haven')

library('rvest')

library('tidyverse')

library('readr')

library('readxl')

library('xlsx')