-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistogramas.Rmd
69 lines (51 loc) · 1.54 KB
/
histogramas.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
---
title: "histogramas"
author: "Juan Baena"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, echo= FALSE, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(hrbrthemes)
```
```{r datos, echo=FALSE}
tidy_presirvienta <- read.csv('data/tidy_presirvienta.csv')
#Convertir a formato de fecha
tidy_presirvienta$timestamp <- ymd_hms(tidy_presirvienta$timestamp)
# Convertir a factores
convertir_fact <- c('author', 'source', 'is_retweet', 'retweeted_user', 'is_quote_tweet', 'quoted_user', 'is_quote_withheld', 'is_reply', 'replied_user', 'is_withheld', 'Emotion')
tidy_presirvienta[convertir_fact] <- lapply(tidy_presirvienta[convertir_fact], as.factor)
# Filtrar las entradas entre el 1 de octubre y el 8 de octubre
# Definir el rango de fechas
start_date <- ymd("2024-10-01")
end_date <- ymd("2024-10-08")
# Filtrar las filas dentro del rango de fechas
tidy_presirvienta <- tidy_presirvienta %>%
filter(timestamp >= start_date & timestamp <= end_date)
```
```{r}
tidy_presirvienta %>%
filter(like_count < 1500) %>%
ggplot(aes(x= like_count)) +
geom_histogram(binwidth = 10)+
theme_ft_rc() +
labs(
title = "Distribución del conteo de likes",
x = "Número de likes",
y = "Frecuencia"
)
```
```{r}
tidy_presirvienta %>%
filter(like_count < 1500) %>%
ggplot(aes(x= like_count)) +
geom_histogram(binwidth = 10, colour = ft_cols$red)+
theme_ft_rc() +
facet_wrap( ~Emotion)
labs(
title = "Distribución del conteo de likes",
x = "Número de likes",
y = "Frecuencia"
)
```