Documents

Data Manipulation using R Tutorial

Description
Data Manipulation using R and ggplot2 hands-on tutorial
Categories
Published
of 7
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  R Notebook How to select file from dialogue box   using R and Load into Data Frame df =  read.table ( file.choose (), header = TRUE, sep =  , )   View (df)   Extract Column from data frame   brain = df[ Brain ]   print ( summary (brain))   ## Brain ## Min. : 79.06 ## 1st Qu.: 85.48 ## Median : 90.54 ## Mean : 90.68 ## 3rd Qu.: 94.95 ## Max. :107.95  Perform Data Visualization using ggplot2 library (ggplot2)   ## Warning: package 'ggplot2' was built under R version 3.4.4   custdata =  read.table ( file.choose (), header=TRUE,sep='\t')   View (custdata)   ggplot (custdata) +   geom_histogram ( aes (x=age), binwidth=5)      Let’s increase some binwidth and see what happens ggplot (custdata) +   geom_histogram ( aes (x=age), binwidth=10)   Let’s Plot some Categorical Data  ggplot (custdata) +   geom_bar ( aes (x=marital.stat))  Apply Corelation on data points cor (custdata $ age, custdata $ income)   ## [1] 0.02742927   custdata2 =  subset (custdata,(custdata $ age > 0  &   custdata $ age   < 100  &   custdata $ income > 0))   cor (custdata2 $ age, custdata2 $ income)   ## [1] -0.02240845   Business Data Analysis  We have yelp_academic_business_dataset for data visualization library (ggplot2)   business_data =  read.csv (file =  E:/Training/Coursera/Social Media Data Analy itcs/Week 3/R Data Analytics/yelp_academic_dataset_business.json.csv )   ggplot (business_data) +   geom_bar ( aes (x=state), fill= gray )      Now We are going to Plot Pie-Chart illustrates Stas distribution   ggplot (data=business_data, aes (x= factor (1),fill= factor (stars))) +   geom_bar (width=1) +coord_polar (theta =  y )  
Search
Tags
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks