R Markdown

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

Including Plots

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.

Generacion de 100 numeros aleatorios del 15 hasta el 50

 datos=sample(15:50,size=100,replace = TRUE)
datos
##   [1] 44 19 36 45 26 46 39 42 44 45 27 49 36 22 15 36 26 48 26 38 45 36 23
##  [24] 20 48 43 27 21 24 31 25 41 15 32 26 41 24 19 18 15 23 20 43 46 26 50
##  [47] 42 29 30 40 22 16 42 18 27 16 43 40 48 28 16 32 43 48 16 31 39 43 15
##  [70] 19 19 17 23 25 45 47 22 19 48 42 16 23 36 31 40 36 19 20 25 44 35 23
##  [93] 32 48 37 32 32 28 45 42
##Determina la media
 media=mean(datos)
media
## [1] 31.85
##Se determina la mediana
 mediana=median(datos)
mediana
## [1] 31.5
##Maximo valor
 maximo=max(datos)
maximo
## [1] 50
##Minimo valor
 minimo=min(datos)
minimo
## [1] 15
##Se determina la frecuencia 
 frecuencia=table(datos)
frecuencia
## datos
## 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 35 36 37 38 39 40 41 
##  4  5  1  2  6  3  1  3  5  2  3  5  3  2  1  1  3  5  1  6  1  1  2  3  2 
## 42 43 44 45 46 47 48 49 50 
##  5  5  3  5  2  1  6  1  1
##Frecuencia relativa 
 freq.relativa=(frecuencia)/margin.table(frecuencia)
freq.relativa
## datos
##   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29 
## 0.04 0.05 0.01 0.02 0.06 0.03 0.01 0.03 0.05 0.02 0.03 0.05 0.03 0.02 0.01 
##   30   31   32   35   36   37   38   39   40   41   42   43   44   45   46 
## 0.01 0.03 0.05 0.01 0.06 0.01 0.01 0.02 0.03 0.02 0.05 0.05 0.03 0.05 0.02 
##   47   48   49   50 
## 0.01 0.06 0.01 0.01
##Vizualizacion del plot
 plot(frecuencia)

plot
## function (x, y, ...) 
## UseMethod("plot")
## <bytecode: 0x000000000f709160>
## <environment: namespace:graphics>