forked from joanby/r-basic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03-people.Rmd
More file actions
41 lines (31 loc) · 686 Bytes
/
Copy path03-people.Rmd
File metadata and controls
41 lines (31 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
title: "03-people"
author: "Curso de Estadística Descriptiva"
date: "24/12/2018"
output:
html_document: default
pdf_document: default
---
# Ejemplo de color de ojos y de pelo
```{r}
HairEyeColor
sum(HairEyeColor) -> total
```
El total de individuos de la tabla de datos es `r total`.
```{r}
prop.table(HairEyeColor, margin = 3)
prop.table(HairEyeColor, margin = c(1,2))
```
```{r}
aperm(HairEyeColor, perm = c("Sex", "Hair", "Eye"))
```
```{r}
library(kableExtra)
kable(HairEyeColor)
```
```{r, results='asis'}
library(xtable)
sex = factor(c("H", "M", "M", "M", "H", "H", "M", "M"))
ans = factor(c("S", "N", "S", "S", "S", "N", "N", "S"))
xtable(table(sex, ans))
```