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.

#Asignación de la semana.

#1-Crear un archivo R Markdown. #2-Crear una cuenta en RPubs y guardar este archivo. #3-Cargue la librería tree

#4-Cree un data.frame a partir de los datos de tree con el siguiente filtro: “deseamos los árboles con una altura entre 70 y 80 pies y un diámetro de menos de 13 pugadas”. Guarde esta data.frame en una varaible que se llame Arboles .

#5-Cree un gráfico de puntos (cuadrados) de el diámetro vs altura. Ponga como título Altura y Ancho de Árboles Cherry Negros. En los ejes deben aparecer las respectivas unidades (diámetro (pulgadas), altura (pies)). Agregue color verde a los puntos que se encuentran en el filtro del inciso 4. Y los puntos que no cumplan con esas especificaciones que se mantengan en color negro. Agregue una leyenda que diga “Diametro vs Altura”.

#6-En el campus virtual se habilitará un espacio para que copien la dirección de la publicación en Rpub donde tienen el trabajo, agreguen al inicio su información personal, como nombre y números de cuenta.

data("trees")
trees
##    Girth Height Volume
## 1    8.3     70   10.3
## 2    8.6     65   10.3
## 3    8.8     63   10.2
## 4   10.5     72   16.4
## 5   10.7     81   18.8
## 6   10.8     83   19.7
## 7   11.0     66   15.6
## 8   11.0     75   18.2
## 9   11.1     80   22.6
## 10  11.2     75   19.9
## 11  11.3     79   24.2
## 12  11.4     76   21.0
## 13  11.4     76   21.4
## 14  11.7     69   21.3
## 15  12.0     75   19.1
## 16  12.9     74   22.2
## 17  12.9     85   33.8
## 18  13.3     86   27.4
## 19  13.7     71   25.7
## 20  13.8     64   24.9
## 21  14.0     78   34.5
## 22  14.2     80   31.7
## 23  14.5     74   36.3
## 24  16.0     72   38.3
## 25  16.3     77   42.6
## 26  17.3     81   55.4
## 27  17.5     82   55.7
## 28  17.9     80   58.3
## 29  18.0     80   51.5
## 30  18.0     80   51.0
## 31  20.6     87   77.0
data.frame(trees)
##    Girth Height Volume
## 1    8.3     70   10.3
## 2    8.6     65   10.3
## 3    8.8     63   10.2
## 4   10.5     72   16.4
## 5   10.7     81   18.8
## 6   10.8     83   19.7
## 7   11.0     66   15.6
## 8   11.0     75   18.2
## 9   11.1     80   22.6
## 10  11.2     75   19.9
## 11  11.3     79   24.2
## 12  11.4     76   21.0
## 13  11.4     76   21.4
## 14  11.7     69   21.3
## 15  12.0     75   19.1
## 16  12.9     74   22.2
## 17  12.9     85   33.8
## 18  13.3     86   27.4
## 19  13.7     71   25.7
## 20  13.8     64   24.9
## 21  14.0     78   34.5
## 22  14.2     80   31.7
## 23  14.5     74   36.3
## 24  16.0     72   38.3
## 25  16.3     77   42.6
## 26  17.3     81   55.4
## 27  17.5     82   55.7
## 28  17.9     80   58.3
## 29  18.0     80   51.5
## 30  18.0     80   51.0
## 31  20.6     87   77.0
data1<-as.data.frame(trees)
data1
##    Girth Height Volume
## 1    8.3     70   10.3
## 2    8.6     65   10.3
## 3    8.8     63   10.2
## 4   10.5     72   16.4
## 5   10.7     81   18.8
## 6   10.8     83   19.7
## 7   11.0     66   15.6
## 8   11.0     75   18.2
## 9   11.1     80   22.6
## 10  11.2     75   19.9
## 11  11.3     79   24.2
## 12  11.4     76   21.0
## 13  11.4     76   21.4
## 14  11.7     69   21.3
## 15  12.0     75   19.1
## 16  12.9     74   22.2
## 17  12.9     85   33.8
## 18  13.3     86   27.4
## 19  13.7     71   25.7
## 20  13.8     64   24.9
## 21  14.0     78   34.5
## 22  14.2     80   31.7
## 23  14.5     74   36.3
## 24  16.0     72   38.3
## 25  16.3     77   42.6
## 26  17.3     81   55.4
## 27  17.5     82   55.7
## 28  17.9     80   58.3
## 29  18.0     80   51.5
## 30  18.0     80   51.0
## 31  20.6     87   77.0
data("trees")
print(trees)
##    Girth Height Volume
## 1    8.3     70   10.3
## 2    8.6     65   10.3
## 3    8.8     63   10.2
## 4   10.5     72   16.4
## 5   10.7     81   18.8
## 6   10.8     83   19.7
## 7   11.0     66   15.6
## 8   11.0     75   18.2
## 9   11.1     80   22.6
## 10  11.2     75   19.9
## 11  11.3     79   24.2
## 12  11.4     76   21.0
## 13  11.4     76   21.4
## 14  11.7     69   21.3
## 15  12.0     75   19.1
## 16  12.9     74   22.2
## 17  12.9     85   33.8
## 18  13.3     86   27.4
## 19  13.7     71   25.7
## 20  13.8     64   24.9
## 21  14.0     78   34.5
## 22  14.2     80   31.7
## 23  14.5     74   36.3
## 24  16.0     72   38.3
## 25  16.3     77   42.6
## 26  17.3     81   55.4
## 27  17.5     82   55.7
## 28  17.9     80   58.3
## 29  18.0     80   51.5
## 30  18.0     80   51.0
## 31  20.6     87   77.0
tabla2<-trees[1:17,]
tabla2[,1]<-1*tabla2[,1]
tabla2
##    Girth Height Volume
## 1    8.3     70   10.3
## 2    8.6     65   10.3
## 3    8.8     63   10.2
## 4   10.5     72   16.4
## 5   10.7     81   18.8
## 6   10.8     83   19.7
## 7   11.0     66   15.6
## 8   11.0     75   18.2
## 9   11.1     80   22.6
## 10  11.2     75   19.9
## 11  11.3     79   24.2
## 12  11.4     76   21.0
## 13  11.4     76   21.4
## 14  11.7     69   21.3
## 15  12.0     75   19.1
## 16  12.9     74   22.2
## 17  12.9     85   33.8
x<-seq(from=8.3,to=20,length.out=20)
y<-seq(from=1,to=100,length.out=20)
colores<-(2)
plot(x,y,type="b",main="Altura y Ancho de Árboles Cherry Negros",xlab="Diametro",ylab="Altura",col=colores,lty=4,pch=c(7),cex=1.5,lwd=1.5,xlim=c(8.3,20),ylim=c(1,90))
points(x=0,y=0,pch=2,cex=2)
points( col=3,x=8.3, y=70)
points( col=1, pch=5, x=8.6, y=65)
points( col=1,pch=5, x=8.8, y=63)
points( col=3,x=10.5, y=72)
points( col=3,x=10.7, y=81)
points( col=3,x=10.8, y=83)
points( col=1,pch=5, x=11, y=66)
points( col=3,x=11, y=75)
points( col=3,x=11.1, y=80)
points( col=3,x=11.2, y=75)
points( col=3,x=11.3, y=83)
points( col=3,x=11.4, y=76)
points( col=3,x=11.4, y=77)
points( col=1,pch=5, x=11.7, y=69)
points( col=3,x=12, y=75)
points( col=3,x=12.9, y=74)
points( col=3,x=12.9, y=85)
points( col=1,pch=5, x=13.3, y=86)
points( col=1,pch=5, x=13.7, y=71)
points( col=1,pch=5, x=13.8, y=64)
points( col=1,pch=5, x=14, y=68)
points( col=1,pch=5, x=14.2, y=80)
points( col=1,pch=5, x=14.5, y=74)
points( col=1,pch=5, x=16, y=72)
points( col=1,pch=5, x=16.3, y=77)
points( col=1,pch=5, x=17.3, y=81)
points( col=1,pch=5, x=17.5, y=82)
points( col=1,pch=5, x=17.9, y=80)
points( col=1,pch=5, x=18, y=80)
points( col=1,pch=5, x=18, y=85)
points( col=1,pch=5, x=20, y=87)
legend("bottomright",legend =c("Diametro vs Altura"),c("arboles que cumplen el filtro 4","Arboles que no lo cumplen","Funcion seno"),pch=1,lty=4, col=3)

```