Skip to content

Instantly share code, notes, and snippets.

@LetticiaNicoli
Created May 22, 2019 23:55
Show Gist options
  • Save LetticiaNicoli/7ffd5bdfc1231542efafb9fa9158d465 to your computer and use it in GitHub Desktop.
Save LetticiaNicoli/7ffd5bdfc1231542efafb9fa9158d465 to your computer and use it in GitHub Desktop.
R - Review Vetor e Matriz
#Review
#Vetor
vet_a = c(333658,19960204,829,399097,1234)
vet_b = vet_a * 2
vet_c = vet_b / 3
vet_d = vet_c + vet_a^2 #or vet_a**2
vet_e = sqrt(vet_d)
vet_ai = rev(vet_a) #or vet_a[5:1]
#Matriz
m1 = matrix(vet_a, ncol = 5, nrow = 6, byrow = TRUE)
m1x = matrix(c(vet_a,vet_b,vet_c,vet_d,vet_e,vet_ai),
ncol = 5, nrow = 6, byrow = TRUE)
m2 = matrix(c(vet_a,vet_b,vet_c,vet_d,vet_e,vet_ai),
ncol = 6, nrow = 5)
m3 = m1 * 0.1
#Tabela
m4 = as.matrix(attitude[10:14,1:6])
class(attitude)
dim(attitude)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment