1.Perform the following tasks:
Use the in-built dataset mtcars, by configuring parameters mfrow with 2,2 and generate 4 graphs by using the following parameters and view how the graphs are plotted.
mtcars$mpg vs mtcars$cyl
mtcars$mpg vs mtcars$hp
mtcars$mpg vs mtcars$wt
mtcars$mpg vs mtcars$vs
2.Perform the following tasks:
Use the in-built dataset Orange, and generate a bar chart for the column Tree.
Use the following for the bar chart.
Name of the chart - Trees count
x-axis - Tree Types
y-axis - count
Ensure that the barplot is red in color.
3.Perform the following tasks:
Rotate the bar chart generated in the previous step to horizontal, change both the axes and change the color of the bar chart to green
4.Perform the following tasks:
Create a Stacked bar plot using in-built dataset mtcars and column cyl and gear.
5.Perform the following tasks:
Create a Pie chart for the top 6 entries of the mtcars dataset. Plot the mpg values against the row name(labels) of the dataset.
I tried with this code, but maybe I am not able to understand the question correctly, as in katacoda environment. I am not able to move forward. Code:
data(mtcars)
par(mfrow=c(2,2))
plot(mtcars$mpg,mtcars$cyl)
plot(mtcars$mpg,mtcars$hp)
plot(mtcars$mpg,mtcars$wt)
plot(mtcars$mpg,mtcars$vs)
data(Orange)
plot(Orange$Tree)
count<-table(Orange$Tree)
barplot(count,main="Trees count",xlab="Tree Types",ylab="count",col="Red")
barplot(count,main="Trees count",xlab="count",ylab="Tree Types",col="Green",horiz="TRUE",las=1)
data(mtcars)
plot(mtcars$cyl,mtcars$gear)
data(mtcars)
pie(table(mtcars$mpg[1:6]),labels=row.names(mtcars)[1:6])