Page 252 - Data Science class 11
P. 252
7.3 r BuIlt-In data sets
For the study of statistical data required in various plot types, R uses several built-in data sets.
The most commonly used R built-in data sets are:
• mtcars: Motor Trend Car Road Tests
• iris
• ToothGrowth
• PlantGrowth
• USArrests
R’s mtcars dataset was developed in response to the Coursera Regression Models class in the Data Science
Specialization taught by Prof. Brian Caffo for the course project assignment: "You work for Motor Trend, a magazine
about the automobile industry.
This data set was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects
of automobile design and performance for 32 automobiles (1973–74 models).
Gross horsepower measures the theoretical output of an engine’s power output; notably, gross rating is of the engine
in an isolated environment outside any specific vehicle.
• mpg: Miles/US Gallon mpg is the determinant of fuel efficiency
• wt: The overall weight of the vehicle per 1000lbs (half US ton)
7.3.1 exploration of air Quality dataset
This data set has daily air quality measurements in New York from May to September 1973, over a period of 5 months.
A data frame with 153 observations on 6 variables.
[,1] Ozone numeric Ozone (ppb)
[,2] Solar.R numeric Solar R (lang)
[,3] Wind numeric Wind (mph)
[,4] Temp numeric Temperature (degrees F)
[,5] Month numeric Month (1--12)
7.4 pIe chart/graph
A pie chart is a circular statistical graphic that is divided into slices to illustrate numerical proportions. It depicts a
special chart that uses "pie slices" where each sector shows the relative sizes of data. A circular chart, cut in the form
of radii into segments describing relative frequencies or magnitudes, is also known as a circle graph. Pie charts are
not recommended in the R documentation, and their features are somewhat limited.
R uses the function pie() to create pie charts. It takes positive numbers as a vector input.
Syntax:
The basic syntax for creating pie chart in R is:
pie(x, labels, radius, main, col, clockwise)
Parameters:
• x: This parameter is a vector that contains the numeric values that are used in the pie chart.
• labels: This parameter gives the description of the slices in the pie chart.
• radius: This parameter is used to indicate the radius of the circle in the pie chart(a value between -1 and +1).
• main: This parameter represents the title of the pie chart.
250 Touchpad Data Science-XI

