Anda di halaman 1dari 2

TUGAS KOMPSTAT

1 Apa hasil perintah berikut, intepretasikan:


tes.1 = c(70, 80, 90, 70)
tes.2 = c(79, 83, 95, 80)
tes.3 = c(65, 75, 97, 80)
cbind(tes.1, tes.2, tes.3)
rbind(tes.1, tes.2, tes.3)
tes = cbind(tes.1, tes.2, tes.3)
tes
tes2 = rbind(tes.1, tes.2, tes.3)
tes2

2 Apa hasil perintah berikut, intepretasikan:


A = matrix (c(1,3,2,4), nrow=2)
B = matrix (c(5,2,-1,4), nrow=2)
C = A*B
C
D = A%*%B
D
E = matrix(c(2,-1,3, 3,2,-1, -1,3,2), nrow=3)
t(E)
solve(E)
eigen(E)
F=diag(5)
F
is.matrix(E)
G = as.vector(E)
G
is.matrix(G)
is.vector(G)
H = matrix(1:12, nrow=4)
rowSums(H)
colSums(H)
rowMeans(H)
colMeans(H)
INFORMASI
apply(x, marjin, fungsi)
- x, menyatakan objek matriks
- marjin, berupa vector menyatakan subskrip yang
dikenai fungsi (1 menyatakan baris, 2 menyatakan
kolom, dan 1:2 menyatakan baris dan kolom)
- fungsi, menyatakan fungsi yang dikenakan pada
matrik x

3 Apa hasil perintah berikut, intepretasikan:


y = matrix(1:12, nrow=4)
y
apply(y, 1, sum)
apply(y, 2, sum)
apply(y, 1, sqrt)
apply(y, 2, sqrt)
apply(y, 2, function(y) y+2)
apply(y, 1, function(y) y-2)

Anda mungkin juga menyukai