Page 1 of 1

Using Rstudio Fill the input

Posted: Fri Jul 01, 2022 5:46 am
by answerhappygod
Using Rstudio
Fill the input
Using Rstudio Fill The Input 1
Using Rstudio Fill The Input 1 (22.6 KiB) Viewed 39 times
In [21]: library(ggplot2) library(ggthemes) head (mpg) Out [21]: For the first few plots, use the mpg dataset In [11]: manufacturer model displ|year cyl trans a4 1.8 1999 4 a4 1.8 1999 4 2008 4 a4 2 a4 2 | 2008 | 4 a4 2.8 1999 6 1999 6 a4 2.8 1 audi 2 audi 3 audi 4 audi 5 audi 6 audi Histogram of hwy mpg values: drv cty hwy fl class auto(15) f manual(m5) f manual(m6) f auto(av) f auto(15) f manual(m5) f 18 29 p compact p| compact p| compact 21 29 20 31 21 30 16 26 18 26 p compact p compact p| compact
In [23]: Barplot of car counts per manufacturer with color fill defined by cyl count count 30 8 10 audthevrolebdge ford hondayundaijeeland rovercolmercuryissapontiasubarutoyotakswagen manufacturer factor(cyl) 4 5 6 8
Switch now to use the txhousing dataset that comes with ggplot2 In [54]: head (txhousing) Out [54]: In [74]: 1 Abilene 2000 1 2000 2 Abilene 2000 2 city year month sales volume median listings inventory date 72 5380000 71400 701 6.3 6505000 58700 746 6.6 9285000 58100 784 6.8 9730000 68600 785 6.9 10590000 67300 794 6.8 98 130 3 Abilene 2000 3 2000.083 2000.167 2000.25 98 141 2000.333 156 13910000 66900 780 6.6 2000.417 4 Abilene 2000 4 5 Abilene 2000 5 6 Abilene 2000 6 Create a scatterplot of volume versus sales. Afterwards play around with alpha and color arguments to clarify information. Warning message: : Removed 568 rows containing missing values (geom_point).
In [87]: Add a smooth fit line to the scatterplot from above. Hint: You may need to look up geom_smooth() Warning message: : Removed 568 rows : Removed 568 rows containing non-finite values (stat_smooth). Warning message: containing missing values (geom_point).