-
Notifications
You must be signed in to change notification settings - Fork 0
/
pivot_longer.Rmd
79 lines (50 loc) · 1.39 KB
/
pivot_longer.Rmd
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
title: "R Notebook"
output: html_notebook
editor_options:
chunk_output_type: console
---
```{r}
library(googlesheets4)
library(tidyverse)
library(moments)
library(lubridate)
library(magrittr)
demostracion <- read_sheet("https://docs.google.com/spreadsheets/d/1tA0bcdwAMEVcmlosgVFXmcmfkJNCEZmRB6otM6tgQ08/edit#gid=1004787557")
demostracion %>% glimpse()
demostracion_alargado <- demostracion %>%
pivot_longer(
cols = Portada:`Otras formas de ser del personaje`,
names_to = "competencia",
values_to="calificacion"
)
demostracion_alargado %>%
filter(grepl("personaje",competencia)) %>%
group_by(competencia) %>%
summarise(
asimetria=skewness(value),
promedio=mean(value),
desviacion=sd(value)
)
demostracion_alargado %>%
filter(!grepl("personaje",competencia)) %>%
ggplot(aes(value))+geom_boxplot(aes(color=competencia))+coord_flip()
# demostracion_alargado %<>%
# mutate(dia=as.Date(`Marca temporal`))
demostracion_alargado$`Nombre del alumno:`
demostracion_alargado %<>%
cbind(rep(seq(11),60) %>%
as_tibble()) %>%
rename(
dia=value
) %>%
rename(alumno=`Nombre del alumno:`) %>%
as_tibble()
demostracion_alargado %>%
filter(!grepl("personaje",competencia)) %>%
ggplot(aes(calificacion))+geom_boxplot()+
coord_flip()+
transition_reveal(dia)+
facet_wrap(~alumno)
animate()
```