rto=rnorm(100, mean = 5, sd = 0.25)
rto=round(rto, digits = 2); rto
## [1] 5.12 4.90 4.43 4.59 5.24 5.54 4.88 4.83 5.03 4.36 4.57 4.67 5.09 5.21 5.17
## [16] 5.27 4.86 4.84 4.76 5.13 4.88 5.05 5.01 4.51 4.65 5.07 4.77 5.06 4.62 5.00
## [31] 4.98 5.37 5.11 5.17 4.83 5.04 5.14 5.15 4.69 5.06 4.85 5.36 4.57 4.80 5.20
## [46] 4.67 5.34 4.88 4.95 5.10 5.19 4.66 5.31 5.16 4.86 5.28 5.11 4.94 5.14 5.16
## [61] 4.97 4.86 4.96 4.73 4.85 4.44 5.59 5.01 5.22 4.89 5.15 4.90 4.92 4.74 4.96
## [76] 5.35 5.15 5.09 5.03 5.12 4.91 5.08 4.74 5.16 4.88 5.10 4.82 5.12 4.57 4.93
## [91] 4.96 4.97 5.13 5.01 5.11 4.92 4.60 5.21 5.06 4.89
pH = c(7.6,6,NA, 5, 5, 3.7, 6.3,8,4.2,7)
length(rto)
## [1] 100
rto[length(rto)]
## [1] 4.89
rto[100]
## [1] 4.89
# Cambiar valores
rto[100]=3
rto[100]
## [1] 3
which.max(rto) # Posición (Dónde está)
## [1] 67
rto[which.max(rto)] # (indexar) El número máximo
## [1] 5.59
boxplot(rto)

boxplot(rto, horizontal = T)

sismo=rexp(100, rate=0.6)
hist(sismo,ylim=c(0,50))

#library(readxl)
#datosNE <- read_excel("C:/Users/jmigu/Desktop/datosNE.xlsx")
#View(datosNE)
#hist(repaso$datosNE)
M1 = matrix(data = 1:9, nrow = 3, byrow = T)
M1
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 4 5 6
## [3,] 7 8 9
# [fila, columna]
M1[1,3]
## [1] 3
M2=M1[,-3]
M2
## [,1] [,2]
## [1,] 1 2
## [2,] 4 5
## [3,] 7 8
#Matriz identidad
v1=rep(1,5)
v1
## [1] 1 1 1 1 1
v2=diag(v1)
v2
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 0 0
## [2,] 0 1 0 0 0
## [3,] 0 0 1 0 0
## [4,] 0 0 0 1 0
## [5,] 0 0 0 0 1
#dataframes
MO=c(2,5,9,6,8,5,8,5,6,9)
rto2=rnorm(10,5,3)
df=data.frame(MO,rto2)
df
## MO rto2
## 1 2 1.5714684
## 2 5 3.7191634
## 3 9 6.6716627
## 4 6 4.9695217
## 5 8 8.0291522
## 6 5 4.4906766
## 7 8 0.2561059
## 8 5 1.1549912
## 9 6 9.1537404
## 10 9 5.9283567
df[5,2]=NA
df$Alt=rnorm(10,2,0.25)
df
## MO rto2 Alt
## 1 2 1.5714684 1.982802
## 2 5 3.7191634 1.606244
## 3 9 6.6716627 1.876649
## 4 6 4.9695217 2.147875
## 5 8 NA 2.105907
## 6 5 4.4906766 1.944162
## 7 8 0.2561059 1.889040
## 8 5 1.1549912 2.644970
## 9 6 9.1537404 1.855899
## 10 9 5.9283567 2.102743
colnames(df)=c("N1","N2","N3")
df
## N1 N2 N3
## 1 2 1.5714684 1.982802
## 2 5 3.7191634 1.606244
## 3 9 6.6716627 1.876649
## 4 6 4.9695217 2.147875
## 5 8 NA 2.105907
## 6 5 4.4906766 1.944162
## 7 8 0.2561059 1.889040
## 8 5 1.1549912 2.644970
## 9 6 9.1537404 1.855899
## 10 9 5.9283567 2.102743
Edward Rolf Tufte, sometimes known as "ET", is an American statistician and professor emeritus of political science, statistics, and computer science at Yale University. He is noted for his writings on information design and as a pioneer in the field of data visualization.