使用R时,我遇到了一个问题,我尝试在katacoda环境中使用此代码,但无法继续



1.执行以下任务:
通过使用2,2配置参数mfrow,使用内置数据集mtcars,并使用以下参数生成4张图,并查看图的绘制方式

mtcars$mpg vs mtcars$cyl
mtcars$mpg vs mtcars$hp
mtcars$mpg vs mtcars$wt
mtcars$mpg vs mtcars$vs

2.执行以下任务:
使用内置数据集Orange,并为列Tree生成条形图
使用下面的条形图

Name of the chart - Trees count
x-axis - Tree Types
y-axis - count
Ensure that the barplot is red in color.

3.执行以下任务:
将上一步生成的条形图旋转为水平,更改两个轴,并将条形图的颜色更改为绿色

4.执行以下任务:
使用内置数据集mtcars和列cyl和gear创建堆积条形图。

5.执行以下任务:
为mtcars数据集的前6个条目创建饼图。根据数据集的行名(标签(绘制mpg值。

我试过使用这个代码,但可能我不能正确理解这个问题,就像在katacoda环境中一样。我无法前进。代码:

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])
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)
count<-table(Orange$Tree)
barplot(count, main="Trees count", xlab="Tree Types", ylab="count", col=c("red"))
barplot(count, main="Trees count", xlab="count", ylab="Tree Types", col=c("green"), 
horiz = TRUE)
data(mtcars)
counts <- table(mtcars$cyl, mtcars$gear)
barplot(counts, xlab="cyl", ylab="gear")
pie(table(mtcars$mpg[1:6]),labels=row.names(mtcars)[1:6])