I need help for creating a pie chart using mtcars$mpg and mtcars$carb. I want to do this; I want to create a pie chart showing the total mpg value for each carburetor. Let me explain more much; In the pie chart, each slice will show the value of the carburetors (1,2,3,4,6,8) and shape according to the total mpg value. I writed some of commands but how can i create a tablo with these, how should i continue? I need the best simple way for this. Please help me. Thanks...
> carb1 <- filter(mtcars, carb==1)
> carb2 <- filter(mtcars, carb==2)
> carb3 <- filter(mtcars, carb==3)
> carb4 <- filter(mtcars, carb==4)
> carb6 <- filter(mtcars, carb==6)
> carb8 <- filter(mtcars, carb==8)
> summpg_carb1 <- sum(carb1$mpg)
> summpg_carb2 <- sum(carb2$mpg)
> summpg_carb3 <- sum(carb3$mpg)
> summpg_carb4 <- sum(carb4$mpg)
> summpg_carb6 <- sum(carb6$mpg)
> summpg_carb8 <- sum(carb8$mpg)