Data ObjectsThe Dataminingtools.net Team
Data TypesR supports the following data types:NumbersStringsFactorsData FramesTablesOne Way TablesTwo Way Tables
NumbersThe "<-" tells R to take the number to the right of the symbol and store it in a variable whose name is given on the left. The "=" symbol can also be used.
Strings> a <- "hello world" > a [1] "hello world" > b <- c("hello", “two") > b [1] "hello" “two" > b[1] [1] "hello" Strings can be stored in variables just like numbers!
FactorsA factor is a vector object used to specify a discrete classification (grouping) of the components of other vectors of the same length. There are two kinds of factors supported:OrderedUnordered
FactorsFactors can be defined like this:
Lists & Data FramesA list is an object consisting of an ordered collection of objects known as its components. There is no particular need for the components to be of the same mode or type, and, for example, a list could consist of a numeric vector, a logical value, a matrix, a complex vector, a character array or a function.
Lists & Data FramesDefining a list:
Lists & Data FramesA data frame is a list with class "data.frame". For a list to be a data frame:The components must be vectors (numeric, character, or logical), factors, numeric matrices, lists, or other data frames.Matrices, lists, and data frames provide as many variables to the new data frame as they have columns, elements, or variables, respectively.Numeric vectors, logicals and factors are included as is, and character vectors are coerced to be factors, whose levels are the unique values appearing in the vector.Vector structures appearing as variables of the data frame must all have the same length, and matrix structures must all have the same row size.
Tables The function table() allows frequency tables to be calculated from equal length factors. If there are k factor arguments, the result is a k-way array of frequencies.
Tables

R Datatypes

  • 1.
  • 2.
    Data TypesR supportsthe following data types:NumbersStringsFactorsData FramesTablesOne Way TablesTwo Way Tables
  • 3.
    NumbersThe "<-" tellsR to take the number to the right of the symbol and store it in a variable whose name is given on the left. The "=" symbol can also be used.
  • 4.
    Strings> a <-"hello world" > a [1] "hello world" > b <- c("hello", “two") > b [1] "hello" “two" > b[1] [1] "hello" Strings can be stored in variables just like numbers!
  • 5.
    FactorsA factor is a vectorobject used to specify a discrete classification (grouping) of the components of other vectors of the same length. There are two kinds of factors supported:OrderedUnordered
  • 6.
    FactorsFactors can bedefined like this:
  • 7.
    Lists & DataFramesA list is an object consisting of an ordered collection of objects known as its components. There is no particular need for the components to be of the same mode or type, and, for example, a list could consist of a numeric vector, a logical value, a matrix, a complex vector, a character array or a function.
  • 8.
    Lists & DataFramesDefining a list:
  • 9.
    Lists & DataFramesA data frame is a list with class "data.frame". For a list to be a data frame:The components must be vectors (numeric, character, or logical), factors, numeric matrices, lists, or other data frames.Matrices, lists, and data frames provide as many variables to the new data frame as they have columns, elements, or variables, respectively.Numeric vectors, logicals and factors are included as is, and character vectors are coerced to be factors, whose levels are the unique values appearing in the vector.Vector structures appearing as variables of the data frame must all have the same length, and matrix structures must all have the same row size.
  • 10.
    Tables The function table() allows frequencytables to be calculated from equal length factors. If there are k factor arguments, the result is a k-way array of frequencies.
  • 11.