Skip to content

MANE 6313

Week 2, Module F - Multivariate Data Creation and Analysis

Multivariate Data Creation

  • Multivariate data sets contain more than one column
  • R stores multivariate data in a Data Frame
  • Demonstrate importing Microsoft Excel data into RStudio

Importing Excel Data

  • Place Excel file in working directory

RStudio


Importing Excel Data, continued

  • From upper right pane, click on Import Dataset
  • Select From Excel RStudio

Importing Excel Data, continued

  • Note: in my installation I had to install an updated packdage for readxl
  • Import Excel Screen appears

RStudio


Importing Excel, continued

  • Select the Excel spreadsheet

RStudio


Importing Excel, continued

  • Notice that the contents of the spreadsheet are displayed in the Data Preview pane
  • The default name is sampleData (see import options)
  • Click on Import to complete process

RStudio


Importing Excel, continued

  • Notice that a new tab appears next to the R Markdown tab (Untitled1)
  • Notice in the upper right pane, that Sample Data has been added

Structure of a Data Frame

  • To examine contents of a data frame, use the str() function

Structure of Data Frame


Accessing a Column

  • Use the data frame name\(\$\)colunm name, e.g. sampleData\(\$\)y

Accessing Column


Descriptive Statistics

  • The techniques used for univariate apply to multivariate data
  • New to this section is correlation analysis

Summary Function

Summary Function


Describe Function

Describe Function


Correlation

  • Correlation can be found between pairs of variables or all variables
  • Example demonstrates rounding correlation results to two decimal places for all pairs of data

Correlation


Graphical Analysis

  • As with descriptive statistics, the univariate graphical analysis techniques apply to multivariate data
  • Introduce matrix of scatter plots

Box Plots

Box Plots


Matrix of Scatter Plots

Scatter Plots