Tuesday, July 10, 2018

Day 4- R Data Structure

Data Structures

  • Collection of data elements
  • Grouped under one name
  • Container

Homogeneouse data structure 
Atomic vector, Matrix, Array

Hetrogeneous data structure 
List, Data Frame


  • Atomic vector
  • 1 Dimension
  • Matrix
  • 2 Dimension
  • Array
  • n Dimension
  • List
  • 1 Dimension
  • Data frame
  • 2 Dimension


Basic Classes of Objects

Atomic Classes

Character
“A”, “c”

Numeric
4.36, 7.42

Integer
3,5

Logical
True, False

Complex
1 + 7i , 8 - 2i

Atomic Vector

  •  Commonly knows as vectors
  •  Homogeneous data structure
# Character
student.names <‐ c("Raj","Rahul","Priya","Poonam")
# Numeric
student.weights <‐ c( 60.5, 72.5 , 45.2, 47.5)
# Integer
student.physics.marks <‐ c( 70L , 75L , 80L, 85L)
# Logical
student.physics.interest <‐ c(FALSE, F, TRUE, T)

Common Operations on Atomic Vectors
  • Arithmetic & logical Subsetting Coercion

Factor
  • Special case of vector used to store nominal values
student.genders <‐ c(“Male",“Male",“Female",“Female")
student.genders <‐ factor(c(“Male",“Male",“Female",“Female"))

List

  • Heterogeneous data structure
  • Can contain items of different classes
  • 1-Dimensional arrangement




No comments:

Post a Comment

How to add a Database to AlwaysOn Availability Group with four different options

To add a database to an existing AlwaysOn availability group, MS has given us four options to choose from Automatic seeding Full database an...