Connecting to PostgreSQL with R
- Connecting and reading from mysql
- Executing Queries
R Binary Files
- When we are working with R, we can pass around data or any R objects such as variables, functions using RData files.
- These are binary files that represent R objects
- Lets create an R Object from recipes
save(recipes, file='data/recipes.rdata')
save(users, file='data/users.rdata')
- If you want to load rdata use
load
function - We can store multiple multiple objects at one shot
Extract Data From Websites
-
Simple HTML Tables:
- If the data are store neatly in html table we can use
readHTMLTable
in the XML package to easily extract the data - The url of the page is http://khajadatascience.com.s3-website-us-west-2.amazonaws.com/ Refer Here
- If the data are store neatly in html table we can use
-
Scraping Web Data:
- Note: Python is very good at scraping web data, so in reality we would use python for this.
- In R there is a package created to extract data in usable format =>
rvest
- Read different html pages information
-
Reading json data
- To read json we have jsonlite library
- To read json we have jsonlite library