A. Creating Vectors

In this section, you are expected to be able to shape data in vectors, perform basic mathematical operations, and also manipulate vectors.

Exercise 1

Create a vector A containing numeric values, starting from the last 2 digits of your student id up to 30.

A<-c(3:30)
A
##  [1]  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
## [26] 28 29 30

Exercise 2

Create a vector B containing 12 character values; all names of your classmate including yourself.

B<-c("Putri", "Nikita", "Jocelyn", "Ardifo", "Jeffry", "Vanessa", "Sherly", "Kefas", "Julian", "Lala", "Siana", "Fallen")
B
##  [1] "Putri"   "Nikita"  "Jocelyn" "Ardifo"  "Jeffry"  "Vanessa" "Sherly" 
##  [8] "Kefas"   "Julian"  "Lala"    "Siana"   "Fallen"

Exercise 3

Create a vector C containing 12 numeric values, random number between 60 and 100.

C<-runif(12, 60, 100)
C
##  [1] 92.55640 76.87697 94.08229 73.05292 92.85043 93.68845 99.79731 99.39925
##  [9] 61.83312 73.46487 77.97405 90.06290

B. Creating Matrices

In this section, you are expected to be able to shape data in Matrices, perform basic mathematical operations, and also manipulate Matrices.

Exercise 4

Create a matrices M1 order by \(rows \times columns \space (4 \times 4)\) containing 16 numeric values, random number between 60 and 100.

a<-runif(16, 100, 200)
M1<-matrix(a, 4, 4)
M1
##          [,1]     [,2]     [,3]     [,4]
## [1,] 121.8007 189.3466 198.5069 191.1880
## [2,] 125.3152 162.0745 142.6238 160.7238
## [3,] 154.0121 175.3286 142.4218 170.2167
## [4,] 108.6694 187.1693 101.9369 176.6635

Exercise 5

Create a matrices M2 order by \(rows \times columns \space (4 \times 4)\) containing 16 numeric values, random number between 30 and 60. Find out the following tasks:

  • 3 * M1, give your opinion about the result.
  • M1 + M2, give your opinion about the result.
  • M1 - M2, give your opinion about the result.
  • M1 * M2, give your opinion about the result.
  • M1 / M2, give your opinion about the result.
  • determinan of M1, give your opinion about the result.
  • invers of M1, give your opinion about the result.
library(matlib)
b<-runif(16, 30, 60)
M2<-matrix(b, 4, 4)
# `3 * M1`, This function will result the matrix A multiplication by 3 for its each element.
# `M1 + M2`, This function will result the addition of M1 and M2.
# `Mi - M2`, This function will result the M1 subtract by M2.
# `Mi * M2`, This function will result the multiplication between M1 and M2.
# `M1/M2`, This function will result the M1 division by M2.
# determinant of `M1`, this function will give you the result of M1 determinant
det(M1)
## [1] 1144635
# Inverse of `M1`, This function will give the inverse of matrix M1.
inv(M1)
##             [,1]        [,2]        [,3]        [,4]
## [1,] -0.01741804  0.02193424  0.00999684 -0.01073714
## [2,]  0.19917111 -0.64251033  0.32771209  0.05323969
## [3,]  0.04200437 -0.09729302  0.04861606 -0.00378511
## [4,] -0.22453820  0.72336606 -0.38140172 -0.04195658

Exercise 6

Create a matrix data that is contain the following vectors:

  • B that you has been created in the exercise 2. Name it as a ‘names’ variable
  • C that you has been created in the exercise 3. Name it as a ‘scores’ variable.
Names<-B
Scores<-C
data<-matrix(rbind(Names, Scores), 2, 12)
data
##      [,1]               [,2]               [,3]              
## [1,] "Putri"            "Nikita"           "Jocelyn"         
## [2,] "92.5563990417868" "76.8769671302289" "94.0822895243764"
##      [,4]               [,5]               [,6]              
## [1,] "Ardifo"           "Jeffry"           "Vanessa"         
## [2,] "73.0529234092683" "92.8504252899438" "93.6884501669556"
##      [,7]               [,8]               [,9]              [,10]             
## [1,] "Sherly"           "Kefas"            "Julian"          "Lala"            
## [2,] "99.7973069828004" "99.3992507178336" "61.833117865026" "73.4648727718741"
##      [,11]              [,12]             
## [1,] "Siana"            "Fallen"          
## [2,] "77.9740542266518" "90.0629026535898"
# In my opinion, the matrix will look better if we make it this way
data<-matrix(Scores, 1, 12, dimnames = list("Score", Names))
data
##         Putri   Nikita  Jocelyn   Ardifo   Jeffry  Vanessa   Sherly    Kefas
## Score 92.5564 76.87697 94.08229 73.05292 92.85043 93.68845 99.79731 99.39925
##         Julian     Lala    Siana  Fallen
## Score 61.83312 73.46487 77.97405 90.0629

C. Lists

In this section, you are expected to be able to shape data by using the list() function, perform some basic manipulations.

Exercise 7

Please create a data set as the List variable by using the list() function, contain the following vectors:

  • a variable name, the values including your classmate and yourself
  • a variable age, the values including your classmate and yourself
  • a variable gender, the values including your classmate and yourself
name<-B
age<-c(19, 19, 19, 19, 19, 18, 19, 18, 15, 20, 23, 24)
gender<-c("female", "female", "female", "male", "male", "female", "female", "male", "male", "female", "female", "male")
List<-list(name, age, gender)
List
## [[1]]
##  [1] "Putri"   "Nikita"  "Jocelyn" "Ardifo"  "Jeffry"  "Vanessa" "Sherly" 
##  [8] "Kefas"   "Julian"  "Lala"    "Siana"   "Fallen" 
## 
## [[2]]
##  [1] 19 19 19 19 19 18 19 18 15 20 23 24
## 
## [[3]]
##  [1] "female" "female" "female" "male"   "male"   "female" "female" "male"  
##  [9] "male"   "female" "female" "male"

D. Factors

In this section, you are expected to be able to shape data by using the factor() function, perform some basic manipulations.

Exercise 8

Please create a data set as the Factor variable as you have done at Exercise 7. Here, you add one more variable called marital_status by using the factor() function, as the following code:

marital_status <- factor(c("yes","no","yes","no", until 12 students))
marital_status <- factor(c("yes","no","yes","no", "yes", "no", "yes", "no", "yes", "no", "yes", "no"))
marital_status
##  [1] yes no  yes no  yes no  yes no  yes no  yes no 
## Levels: no yes

E. Data Frames

In this section, you are expected to be able to shape data by using the data.frame() function, perform some basic manipulations.

Exercise 9

Please create a data set as the DF1 variable, contain the following vectors:

  • id, assume 1 up to 6
  • name the values according to your classmate and yourself
  • gender the values according to your classmate and yourself
  • age the values according to your classmate and yourself
  • marital_status the values according to your classmate and yourself
  • address_by_city the values according to your classmate and yourself
address<-c("Tigaraksa","Jakarta", "Tangerang", "Kalimantan", "Tangerang", "Tobelo", "Jakarta", "Tangerang", "Tangerang", "Tangerang", "Tangerang", "Tangerang", "Tangerang")
DF1<-data.frame(id=1:6, name=head(B, n = 6), gender=head(gender, n=6), age=head(age, n=6), marital_status=head(marital_status, n=6), addres_by_city=head(address, n=6), stringsAsFactors = F)
DF1
##   id    name gender age marital_status addres_by_city
## 1  1   Putri female  19            yes      Tigaraksa
## 2  2  Nikita female  19             no        Jakarta
## 3  3 Jocelyn female  19            yes      Tangerang
## 4  4  Ardifo   male  19             no     Kalimantan
## 5  5  Jeffry   male  19            yes      Tangerang
## 6  6 Vanessa female  18             no         Tobelo

Please create a data set as the DF2 variable, contain the following vectors:

  • id, assume 7 up to 12
  • name the values according to your classmate and yourself
  • gender the values according to your classmate and yourself
  • age the values according to your classmate and yourself
  • marital_status the values according to your classmate and yourself
  • address_by_city the values according to your classmate and yourself
DF2<- data.frame(id = 7:12, name = tail(B, n=6), gender=tail(gender, n=6), age=tail(age, n=6), marital_status=tail(marital_status, n=6), addres_by_city=tail(address, n=6), stringsAsFactors = F)
DF2
##   id   name gender age marital_status addres_by_city
## 1  7 Sherly female  19            yes      Tangerang
## 2  8  Kefas   male  18             no      Tangerang
## 3  9 Julian   male  15            yes      Tangerang
## 4 10   Lala female  20             no      Tangerang
## 5 11  Siana female  23            yes      Tangerang
## 6 12 Fallen   male  24             no      Tangerang

Exercise 10

In this final exercise, please consider the following tasks:

  • Combine DF1 and DF2, assign it as SB19 variable!
  • Print the result of data frame SB19!
  • Print first 3 rows of the SB19 dataset!
  • How can you preview the SB19 dataset like an Excel file on your Rstudio?
  • Review the structure of the data frame SB19!
  • Check the dimension of the data.
  • Please apply piping functions to the data frame SB19, filter it by their gender accordingly! (as you have learn last week)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
SB19 <- rbind(DF1, DF2)
print(SB19)
##    id    name gender age marital_status addres_by_city
## 1   1   Putri female  19            yes      Tigaraksa
## 2   2  Nikita female  19             no        Jakarta
## 3   3 Jocelyn female  19            yes      Tangerang
## 4   4  Ardifo   male  19             no     Kalimantan
## 5   5  Jeffry   male  19            yes      Tangerang
## 6   6 Vanessa female  18             no         Tobelo
## 7   7  Sherly female  19            yes      Tangerang
## 8   8   Kefas   male  18             no      Tangerang
## 9   9  Julian   male  15            yes      Tangerang
## 10 10    Lala female  20             no      Tangerang
## 11 11   Siana female  23            yes      Tangerang
## 12 12  Fallen   male  24             no      Tangerang
head(SB19, 3)
##   id    name gender age marital_status addres_by_city
## 1  1   Putri female  19            yes      Tigaraksa
## 2  2  Nikita female  19             no        Jakarta
## 3  3 Jocelyn female  19            yes      Tangerang
# To preview `SB19` dataset like an excel, you can use function `View(SB19)
View(SB19)
str(SB19)
## 'data.frame':    12 obs. of  6 variables:
##  $ id            : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ name          : chr  "Putri" "Nikita" "Jocelyn" "Ardifo" ...
##  $ gender        : chr  "female" "female" "female" "male" ...
##  $ age           : num  19 19 19 19 19 18 19 18 15 20 ...
##  $ marital_status: Factor w/ 2 levels "no","yes": 2 1 2 1 2 1 2 1 2 1 ...
##  $ addres_by_city: chr  "Tigaraksa" "Jakarta" "Tangerang" "Kalimantan" ...
dim(SB19)
## [1] 12  6
# To show all the male gender, you can type the function as below
SB19 %>% filter(gender == "male")%>% print ()
##   id   name gender age marital_status addres_by_city
## 1  4 Ardifo   male  19             no     Kalimantan
## 2  5 Jeffry   male  19            yes      Tangerang
## 3  8  Kefas   male  18             no      Tangerang
## 4  9 Julian   male  15            yes      Tangerang
## 5 12 Fallen   male  24             no      Tangerang
# To show all the female gender, you can type the function as below
SB19 %>% filter(gender == "female")%>% print ()
##   id    name gender age marital_status addres_by_city
## 1  1   Putri female  19            yes      Tigaraksa
## 2  2  Nikita female  19             no        Jakarta
## 3  3 Jocelyn female  19            yes      Tangerang
## 4  6 Vanessa female  18             no         Tobelo
## 5  7  Sherly female  19            yes      Tangerang
## 6 10    Lala female  20             no      Tangerang
## 7 11   Siana female  23            yes      Tangerang
# To show only people name with male gender, you can type the function with `select` as below
SB19 %>% select(name, gender)%>% filter(gender=="male") %>% print ()
##     name gender
## 1 Ardifo   male
## 2 Jeffry   male
## 3  Kefas   male
## 4 Julian   male
## 5 Fallen   male
# To show only people name with female gender, you can type the function with `select` as below
SB19 %>% select(name, gender)%>% filter(gender=="female")%>% print ()
##      name gender
## 1   Putri female
## 2  Nikita female
## 3 Jocelyn female
## 4 Vanessa female
## 5  Sherly female
## 6    Lala female
## 7   Siana female
LS0tDQp0aXRsZTogIkxhYjM6IFIgQmFzaWNzIg0KYXV0aG9yOiAiSnVsaWFuIFNhbG9tbyINCmRhdGU6ICJgciBmb3JtYXQoU3lzLkRhdGUoKSwgJyVCICVkLCAlWScpYCINCm91dHB1dDogb3BlbmludHJvOjpsYWJfcmVwb3J0DQotLS0NCg0KYGBge3IgTG9nbywgZWNobz1GQUxTRSxmaWcuYWxpZ249J2NlbnRlcicsIG91dC53aWR0aCA9ICc0MCUnfQ0Ka25pdHI6OmluY2x1ZGVfZ3JhcGhpY3MoImh0dHBzOi8vZ2l0aHViLmNvbS9CYWt0aS1TaXJlZ2FyL2ltYWdlcy9ibG9iL21hc3Rlci9sb2dvLnBuZz9yYXc9dHJ1ZSIpDQpgYGANCg0KIyMgQS4gQ3JlYXRpbmcgVmVjdG9ycyANCg0KSW4gdGhpcyBzZWN0aW9uLCB5b3UgYXJlIGV4cGVjdGVkIHRvIGJlIGFibGUgdG8gc2hhcGUgZGF0YSBpbiB2ZWN0b3JzLCBwZXJmb3JtIGJhc2ljIG1hdGhlbWF0aWNhbCBvcGVyYXRpb25zLCBhbmQgYWxzbyBtYW5pcHVsYXRlIHZlY3RvcnMuDQoNCiMjIyBFeGVyY2lzZSAxDQoNCkNyZWF0ZSBhIHZlY3RvciBgQWAgY29udGFpbmluZyBudW1lcmljIHZhbHVlcywgc3RhcnRpbmcgZnJvbSB0aGUgbGFzdCAyIGRpZ2l0cyBvZiB5b3VyIHN0dWRlbnQgaWQgdXAgdG8gMzAuDQoNCmBgYHtyfQ0KQTwtYygzOjMwKQ0KQQ0KICAgIA0KYGBgDQoNCiMjIyBFeGVyY2lzZSAyDQoNCkNyZWF0ZSBhIHZlY3RvciBgQmAgY29udGFpbmluZyAxMiBjaGFyYWN0ZXIg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