Saraswathi Analytics provides Visual Analytics Week 4 solution (Visual Analytics - 202051 - CRN140).

R Markdown - Plotting

  1. Show meta data from the mpg dataframe using summary().
##  manufacturer          model               displ            year     
##  Length:234         Length:234         Min.   :1.600   Min.   :1999  
##  Class :character   Class :character   1st Qu.:2.400   1st Qu.:1999  
##  Mode  :character   Mode  :character   Median :3.300   Median :2004  
##                                        Mean   :3.472   Mean   :2004  
##                                        3rd Qu.:4.600   3rd Qu.:2008  
##                                        Max.   :7.000   Max.   :2008  
##       cyl           trans               drv                 cty       
##  Min.   :4.000   Length:234         Length:234         Min.   : 9.00  
##  1st Qu.:4.000   Class :character   Class :character   1st Qu.:14.00  
##  Median :6.000   Mode  :character   Mode  :character   Median :17.00  
##  Mean   :5.889                                         Mean   :16.86  
##  3rd Qu.:8.000                                         3rd Qu.:19.00  
##  Max.   :8.000                                         Max.   :35.00  
##       hwy             fl               class          
##  Min.   :12.00   Length:234         Length:234        
##  1st Qu.:18.00   Class :character   Class :character  
##  Median :24.00   Mode  :character   Mode  :character  
##  Mean   :23.44                                        
##  3rd Qu.:27.00                                        
##  Max.   :44.00
  1. Show metadata from the gapminder dataframe
##         country        continent        year         lifeExp     
##  Afghanistan:  12   Africa  :624   Min.   :1952   Min.   :23.60  
##  Albania    :  12   Americas:300   1st Qu.:1966   1st Qu.:48.20  
##  Algeria    :  12   Asia    :396   Median :1980   Median :60.71  
##  Angola     :  12   Europe  :360   Mean   :1980   Mean   :59.47  
##  Argentina  :  12   Oceania : 24   3rd Qu.:1993   3rd Qu.:70.85  
##  Australia  :  12                  Max.   :2007   Max.   :82.60  
##  (Other)    :1632                                                
##       pop              gdpPercap       
##  Min.   :6.001e+04   Min.   :   241.2  
##  1st Qu.:2.794e+06   1st Qu.:  1202.1  
##  Median :7.024e+06   Median :  3531.8  
##  Mean   :2.960e+07   Mean   :  7215.3  
##  3rd Qu.:1.959e+07   3rd Qu.:  9325.5  
##  Max.   :1.319e+09   Max.   :113523.1  
## 
  1. assign ggplot(data = gapminder, mapping = aes(x = gdpPercap, y = lifeExp) to the variable ‘p’
  2. find the structure of the p object.
  3. add geom.point() to the p object. Show p.
  4. replace geom.point() with geom.smooth(). Show p.
  5. return to geom.point and add geom.smooth(). Show p.
  6. add the linear element to the geom.smooth function. Show p.
  7. change the x axis scare to log10. Show p.
  8. try scale_y_log10(). Show p.
  9. change the method to gam from lm. Show p.
  10. replace scientific notation on the x axis with dollar signs
  11. identify the continent of each point with color. Show p.
  12. add labels to the plot. Show p.
  13. change the method to loess. Show p.
  14. use fill to change the appearace of lines, points, and the interior of the smoother’s standard error ribbon. S thehow p.
  15. limit the figure size in R markdown to 8 x 5.
  16. save one of your plots in it’s own file.
  17. experiment with saving files in different formats and different locations.
  18. map different attributes from gapminder to see what they look like. Show the result.

Submit a Word document by Sunday at midnight with your screen shots of your work. Explain what each image is.

Note:

  • Only for knowledge gain and helping to the students(who are facing difficulties when solving to the Assessments/ Home works) with their course support.

Contact Us: