O'Reilly logo

Introduction to R for Business Intelligence by Jay Gendron

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required