Bar_Charts_001

Column

barplot

Column

ggplot2

Column

lattice

Bar_Charts_002

Column

Var_Gear

Column

Var_Cyl

Bar_charts_003

Bar_Charts_004

Diagrama Barras

Diagrama Sectores

Histograma

---
title: "Bar Charts"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    social: ['facebook','twitter','linkedin']
    source: embed
---

```{r setup, include=FALSE}

library(ggplot2)

library(lattice)

library(flexdashboard)
```


# Bar_Charts_001 {data-icon=fa-bar-chart}


Column {data-width=333}
-----------------------------------------------------------------------

### barplot

```{r}
x <- table(mtcars$cyl)

colores <- c("orange","blue","purple")

barplot(x,xlab="Cilindros",ylab="Frecuencias",main="Número de Cilindros",col=colores)


```

Column {data-width=333}
-----------------------------------------------------------------------

### ggplot2

```{r}
ggplot(mtcars,aes(cyl)) + geom_bar(fill=colores) + labs(x="Cillindros",y="Frecuencias",title="Número de Cilindros") + theme_dark()


```

Column {data-width=333}
-----------------------------------------------------------------------

### lattice

```{r}
barchart(x,xlab="Cilindros",ylab="Frecuencias",main="Número de Cilindros",col=colores,horizontal=FALSE)


```



# Bar_Charts_002 {data-icon=fa-bar-chart}

Column {data-width=500}
-----------------------------------------------------------------------

### Var_Gear

```{r}
y <- table(mtcars$gear)

barplot(y,xlab="Engranajes",ylab="Frecuencias",main="Número de Engranajes",col=rainbow(3))


```


Column {data-width=500}
-----------------------------------------------------------------------

### Var_Cyl

```{r}
y <- table(mtcars$gear)

par(mfrow=c(1,2))

barplot(x,xlab="Cilindros",ylab="Frecuencias",main="Número de Cilindros",col=colores)

barplot(y,xlab="Engranajes",ylab="Frecuencias",main="Número de Engranajes",col=rainbow(3))


```


# Bar_charts_003 {data-icon=fa-bar-chart}


```{r}
barchart(x,xlab="Cilindros",ylab="Frecuencias",main="Número de Cilindros",col=colores,horizontal=FALSE)


```




# Bar_Charts_004 {data-icon=fa-bar-chart}

## {.tabset}

### Diagrama Barras

```{r}
x <- table(mtcars$cyl)

colores <- c("orange","blue","purple")

barplot(x,xlab="Cilindros",ylab="Frecuencias",main="Número de Cilindros",col=colores)

```


### Diagrama Sectores

```{r}
porcentaje <- c(15.59,8.88,6.66,13.33,11.11,17.77,26.66)

etiqueta <- paste(porcentaje,"%",sep=" ")

colores <- c("purple","orange","blue","yellow","green","skyblue","pink")

pie(porcentaje,labels = etiqueta,clockwise = TRUE,col = colores,
    main = "Gustos musicales de los Estudiantes de Estadística 101")

legend("topright",c("Cumbia","Eletrónica","Hip Hop","Latin","Pop","Rock","Salsa"),cex=0.5,
       fill= colores)

```


### Histograma

```{r}
distance <- c(241.1, 284.4, 220.2, 272.4, 271.1, 268.3,
              291.6, 241.6, 286.1, 285.9, 259.6, 299.6,
              253.1, 239.6, 277.8, 263.8, 267.2, 272.6,
              283.4, 234.5, 260.4, 264.2, 295.1, 276.4,
              263.1, 251.4, 264.0, 269.2, 281.0, 283.2)

hist(distance, prob = TRUE)
grid(nx = NA, ny = NULL, lty = 2, col = "gray", lwd = 1)
hist(distance, prob = TRUE, add = TRUE, col = "purple")
```