class: center, middle, inverse, title-slide # Ciencia de Datos en R ## Sesión 1 ### Edinson Tolentino ### MSc. Economics
@edutoleraymondi
### 2021-02-14 --- layout:true background-image: url(sussex.jpg) background-position: 95% 0% background-size: 15% --- # Introdución .pull-left[ <img src="g1.png" width="300" height="340"/> ] .pull-left[ 1. Autres de R: Ross Ihaka(Izquierda), Robert Gentleman (Derecha) 1. R es un software de analisis de información 1. R vs Python 1. Bibliografia a revisar: - [R for Data Science](https://r4ds.had.co.nz/) - [R para Ciencia de Datos](https://r4ds-en-espaniol.netlify.app/) ] --- # R como software libre <img src="pros-cons-of-R-v2.gif" width="700" height="440"/> --- # Instalar R y Rstudio <iframe width="560" height="415" src="https://www.youtube.com/embed/Nmu4WPdJBRo" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> - Puede ver el video en el siguiente enlace [video](https://www.youtube.com/embed/Nmu4WPdJBRo) --- # El camino de la ciencia de datos <img src="g2.png" width="700" height="440"/> --- # Las Librerias en R <img src="g3.png" width="500" height="440"/> --- # El *Tidyverse* <img src="g4.png" width="600" height="440"/> --- # El *Tidyverse* <img src="g5.png" width="700" height="440"/> --- # Estructura de Datos ## Objetos I - Tipos de objetos: - i) vectores - ii) Data frame - iii) Listas ``` r a <- c(3,4,5) df <- data.frame(Nombre=c("Edu","Juan"), Edad=c(20,30)) Lista1 <- list(A=1, B=c(2,5),C=df) ``` --- ## Funciones I ```r sumar <- function(elemento1, elemento2){ elemento1+elemento2 } sumar(4,5) ``` --- ## Matrices ```r Matriz_1 <- matrix(c(2,3, 5,6),nrow=2,ncol=2) Matriz_1 dimnames(Matriz_1) <-list(c("F1","F2"),c("R1","R2")) Matriz_1 ``` --- ## Matrices ```r A <- matrix(2:8,nrow=4,byrow=TRUE) A B <- matrix(1:14,nrow=4,byrow=TRUE) B #multiplicacion de matrices * AB <- A%*%B AB # Inversa de una matriz * AB_I <- solve(AB) AB_I ``` --- ## Matrices ```r mimatriz <- function(rango1,rango2,filas){ matrix(rango1:rango2,nrow=filas) } mimatriz(1,20,4) ``` --- ## Matrices ```r Diagonal <- diag(1, nrow=4) Diagonal Determinante <- det(Diagonal) Determinante ``` --- ## Matrices: forma 1 Resolver la siguiente sistema de ecucaciones $$ 3x +2y =5 $$ $$ x-y=0 $$ Solución: ```r X <- matrix(c(3,2, 1,-1), nrow=2,byrow = TRUE) y <- c(5,0) solve(X,y) # pagedown::chrome_print("test.html",output="test.pdf") ``` --- ## Matrices: forma 2 ``` r X <- matrix(c(3,2,1,-1), nrow=2, byrow =TRUE) Y <- matrix(c(5,0), ncol=1) * Solucion <-solve(X,Y) Solucion #Colocar nombres a las variables * dimnames(Solucion) <- list(c("x","y"), NULL) * Solucion ``` --- ## Ahora es tu turno: 1. Resolver el siguiente ejercicio - Resolver la siguiente sistema de ecucaciones $$ 3x +2y =1 $$ $$ 3x-7y=2 $$