A continuación presentremos un listado de las estadísticas descriptivas básicas para el análisis de datos y posteriormente veremos como realizar los cálculos con los códigos en R:
#Generamos 100 datos aleatorios
x <- rnorm(100,5,2)
#Visualizamos los datos
print(x)
## [1] 6.007395 3.041054 5.917370 1.939995 4.065259 4.057107 6.239171
## [8] 4.854002 5.317369 2.341175 5.282406 6.853142 5.971030 3.605151
## [15] 7.953116 4.618780 6.698888 4.462816 7.795068 3.031255 2.815164
## [22] 4.060436 6.087645 5.878889 6.244591 7.102010 5.953896 8.485672
## [29] 6.126295 6.021774 5.729448 7.121488 6.854333 6.076182 5.571828
## [36] 5.480302 6.254456 5.226383 1.843786 4.175137 6.922661 7.802755
## [43] 6.823745 5.368729 7.063724 5.041141 4.564167 6.873255 7.273676
## [50] 4.867797 4.539263 3.602626 3.110885 6.136024 7.050610 2.191765
## [57] 6.001700 3.401775 1.685891 4.618689 5.326953 5.721293 6.493889
## [64] 5.354208 3.951132 5.548797 3.286497 6.093054 4.239239 6.017990
## [71] 10.461736 1.895972 6.655175 2.506017 3.196407 5.141932 3.490654
## [78] 6.147377 4.769390 4.041746 2.870105 6.855393 6.753962 2.534978
## [85] 5.686935 5.215297 6.235203 5.585724 5.544341 7.083166 6.326302
## [92] 8.772992 5.611770 7.376585 5.719376 3.730929 8.151065 2.815166
## [99] 6.272606 2.747473
#Calculamos la media
mean(x)
## [1] 5.30331
A continuación mostraremos un ejemplo de como generar un histograma
hist(x, col="green")
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.