chapter one data managment in R

in this chapter we will cover a number of functions and command and packaged using in R

data types in R

There are 6 differnt data types in r inclouding:

  • vectors
  • Matrix
  • Array
  • List
  • Data frame
  • factors

Vectors

Vectors are the fundamental components for all data types in r based on the scale of measurement, they can categorized into six different components including:

  1. charecter
  2. ordered
  3. factors
  4. integerts
  5. numeric
  6. logical

Example 1

data("Titanic")
Titanic
## , , Age = Child, Survived = No
## 
##       Sex
## Class  Male Female
##   1st     0      0
##   2nd     0      0
##   3rd    35     17
##   Crew    0      0
## 
## , , Age = Adult, Survived = No
## 
##       Sex
## Class  Male Female
##   1st   118      4
##   2nd   154     13
##   3rd   387     89
##   Crew  670      3
## 
## , , Age = Child, Survived = Yes
## 
##       Sex
## Class  Male Female
##   1st     5      1
##   2nd    11     13
##   3rd    13     14
##   Crew    0      0
## 
## , , Age = Adult, Survived = Yes
## 
##       Sex
## Class  Male Female
##   1st    57    140
##   2nd    14     80
##   3rd    75     76
##   Crew  192     20
x<-c(12,11.5, 12.5, 13.5, 21,23,24,21,25,26)
plot(density(x))

hist(x)

boxplot(x)

Example 2

y<-c(T,T,T,T,F,F,F,F,T,F)
table(y)
## y
## FALSE  TRUE 
##     5     5
barplot(y)