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.

Introducción

##Sumas

Primera practica que vamos hacer es sumar

5+10
## [1] 15

Multiplicar

75*460
## [1] 34500

Base de datos

Vamos a generar mi primer base de datos

base<-cbind(color_pelo="cafe","cafe","negro","amarillo","calvo",
            Altura=180,150,168,175,175)
base
##      color_pelo                                   Altura                  
## [1,] "cafe"     "cafe" "negro" "amarillo" "calvo" "180"  "150" "168" "175"
##           
## [1,] "175"

Funciones

Vamos a hacer alguna funcion

funcion1<-function(a,b,c){
  variable<-a+b+c
  print(variable)
}
funcion1(100,200,3000)
## [1] 3300

Ahora vamos a hacer otra funcion mas compleja

funcion2<-function(a,b,c){
  variable1<-a*b
  variable2<-variable1/c
  print(variable2)
}
funcion2(2,2,2)
## [1] 2