Data Types in R and their Modes - Statistics-and-Machine-Learning-with-R/Statistical-Methods-and-Machine-Learning-in-R GitHub Wiki

Data Types

Click for R-Script

Wiki_Page_DataTypes_1 (1)

There are several data types depending upon the nature of work one has to do. Following is a list in which you can store data.

Vector

  • It contains a sequence of items of the same type. This is most basic structure, e.g. x <- 10 or name <- β€˜Harry’

Factor

  • A Factor is a Categorical Variable.
  • A Categorical variable represents types of attributes. e.g. Gender: Male, Female or Flavors of ice cream: Chocolate, Vanilla, Strawberry.

D1_new

Array

  • An Array is a table with β€˜k’ dimensions. Usually used to store data in a table format. If we create an array of dimensions (2,3,4) then 4 rectangular matrices will be created, each with 2 rows and 3 columns.

Array (1)

Source: https://www.tutorialspoint.com/r/r_arrays.htm

Matrix

  • A Matrix is an Array, but having specifically two dimensions, e.g. β€˜k=2’.

matrix

Data Frame

  • A data frame is a table composed with one or several vectors and/or factors all of the same lengths but possibly of different modes. A data frame may contain multiple arrays.

Data Frame

TS – Time Series

  • A TS is a Time Series dataset, additionally it contains attributes like frequency and dates.

Time Series

List

  • A list is the ultimate data type to store every element, including vectors, factors, data frames, and even list itself.

Wiki_Page_DataTypes_11

Data Types & Their Modes

Data types and their modes Source: https://slideplayer.com/slide/5158709/