-
Notifications
You must be signed in to change notification settings - Fork 0
/
matris_dizi.R
42 lines (24 loc) · 1.01 KB
/
matris_dizi.R
1
2
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Dizi ve Matrisler
movie_vector <- c("Akira", "Toy Story", "Room", "The Wave", "Whiplash", "Star Wars", "The Ring", "The Artist", "Jumanji")
movie_vector
movie_array <- array(movie_vector, dim = c(4,3)) # 4x3 lük dizi
movie_array
# Vektörden dizi oluþtururken deðerleri sýralý olarak satýrlara yazar.
movie_array[1,2] #Satýr,Sütun -- row, column
movie_array[1,] #1. Satýrýn tamamýný vektör halinde verir
movie_array[,2] #2. Sütunun tamamýný vektör halinde verir
# Dizinin boyutunu öðrenme
dim(movie_array)
# Dizilere matematiksel iþlemler uygulanabilir
length_vector <- c(125, 81, 118, 81, 106, 121, 95, 100, 104)
length_array <- array(length_vector, dim = c(3,3))
length_array
length_array + 5
# Matris
movie_matrix <- matrix(movie_vector, nrow = 3, ncol = 3) #3x3 matris oluþturma
movie_matrix
movie_matrix[2:3, 1:2] #2-3 satýr, 1-2. sütun
#Matrise yeni deðer ekleme
upcoming_movie <- c("Fast and Furious 8", "xXx: Return of Xander Cage", "Suicide Squad")
new_vector <- c(movie_vector, upcoming_movie)
new_vector