Loading the ‘mtcars’ dataset in R

PART 1 – Summarizing a Dataframe

Find total number of data points into mtcars dataset

## [1] 32

Find total number of columns into mtcars dataset

## [1] 11

Find total number of rows & columns into mtcars dataset

## [1] 32 11

Find the column names of the mtcars dataset

##  [1] "mpg"  "cyl"  "disp" "hp"   "drat" "wt"   "qsec" "vs"   "am"   "gear"
## [11] "carb"

PART 2 – Summarizing a Data Column within a Data Frame

Using $ to access columns within a dataframe

##  [1] 21.0 21.0 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 17.8 16.4 17.3 15.2 10.4
## [16] 10.4 14.7 32.4 30.4 33.9 21.5 15.5 15.2 13.3 19.2 27.3 26.0 30.4 15.8 19.7
## [31] 15.0 21.4

Attach the dataframe

Detach the dataframe

Find the length of the variable ‘mpg’ in the mtcars data

## [1] 32

Find the minimum of the variable ‘mpg’ in the mtcars data

## [1] 10.4

Find the maximum of the variable ‘mpg’ in the mtcars data

## [1] 33.9

Find the sum of the variable ‘mpg’ in the mtcars data

## [1] 642.9

Find the mean of the variable ‘mpg’ in the mtcars data

## [1] 20.09062