Analyzing a single data variable

If your dataset has a single variable, you have univariate data. When examining univariate data, you may describe the data distribution in terms of its value and spread. A good place to begin the exploration of univariate data is with the str() function that you learned in Chapter 2, Data Cleaning. Load the marketing dataset into R and run the str() function:

marketing <- read.csv("./data/Ch3_marketing.csv", stringsAsFactors = TRUE) 
str(marketing) 

We will get the following output:

'data.frame':  172 obs. of  7 variables:
 $ google_adwords : num  65.7 39.1 174.8 34.4 78.2 ...
 $ facebook       : num  47.9 55.2 52 62 40.9 ...
 $ twitter        : num  52.5 77.4 68 86.9 30.4 ...
$ marketing_total: num  166 172 295 183 150 ...
 $ revenues ...

Get Introduction to R for Business Intelligence now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.