Primer Trabajo

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

> x<-c(21,33,12,34,23,70,90,80,7,29,14,2, 88,11,55,24,13,11,56,28,33)

> x
[1] 21 33 12 34 23 70 90 80 7 29 14 2 88 11 55 24 13 11 56 28 33
> n<-length(x)
> n
[1] 21
> promediox<-sum(x)/length(x)
> promediox
[1] 34.95238
> round(promediox)
[1] 35
> mean(x)
[1] 34.95238
> promedio<-sum(x)/n
> promedio
[1] 34.95238
>
>
>
>
> s<-sqrt(sum((x-promediox)^2/(n-1)))
> s
[1] 27.34863
> sd(x)
[1] 27.34863
>
>
>
>
> x_menor30<-x[x<30]
> x_menor30
[1] 21 12 23 7 29 14 2 11 24 13 11 28
> pm30<-mean(x_menor30)
> pm30
[1] 16.25
> verificacion_promedio<-(sum(x[x<30])/(length(x_menor30)))
> verificacion_promedio
[1] 16.25
>
> x_menor30
[1] 21 12 23 7 29 14 2 11 24 13 11 28
> length(x_menor30)
[1] 12
>
>
>
> sd_menor30<-sd(x_menor30)
> sd_menor30
[1] 8.561276
>
>
> sd_menor30_validacion<-sqrt(sum((x_menor30 - pm30)^2/(length(x_menor30)-1))
+ )
> sd_menor30_validacion
[1] 8.561276
>
>
>
>
>
>
> by7<-rep(seq(7,28, 3)
+ )
> by7
[1] 7 10 13 16 19 22 25 28
>
>
> rep(seq(7,28, b7), 3)
Error: objeto 'b7' no encontrado
> rep(seq,7,28, by=7), 3)
Error: inesperado ',' en "rep(seq,7,28, by=7),"
> rep(seq(7,28, by=7), 3)
[1] 7 14 21 28 7 14 21 28 7 14 21 28
>
>
>
>
>
>

> help(quantile)
> help(rnorm)
>
>
>
>
> info<-c(edad=34, altura=180, codigo_postal=282000)
> info
edad altura codigo_postal
34 180 282000
> class(info)
[1] "numeric"
>
> ident<-matrix(info,3,3)
> ident
[,1] [,2] [,3]
[1,] 34 34 34
[2,] 180 180 180
[3,] 282000 282000 282000
>
> ident2<-matrix(0,3,3)
> ident2
[,1] [,2] [,3]
[1,] 0 0 0
[2,] 0 0 0
[3,] 0 0 0
>

You might also like