##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(RColorBrewer)
#file.choose()
archivo <- readLines("C:\\Users\\Lesgo\\OneDrive\\Escritorio\\TEC\\Análisis\\MOD 4\\himno.txt")## Warning in
## readLines("C:\\Users\\Lesgo\\OneDrive\\Escritorio\\TEC\\Análisis\\MOD
## 4\\himno.txt"): incomplete final line found on
## 'C:\Users\Lesgo\OneDrive\Escritorio\TEC\Análisis\MOD 4\himno.txt'
## [1] "mexicanos" "al" "grito" "de" "guerra" "el"
## [1] 496
## [1] 92
## anger anticipation disgust fear joy sadness surprise trust negative positive
## 1 0 0 0 0 0 0 0 0 0 0
## 2 0 0 0 0 0 0 0 0 0 0
## 3 2 0 0 1 0 1 2 0 2 0
## 4 0 0 0 0 0 0 0 0 0 0
## 5 1 0 0 2 0 1 0 0 2 0
## 6 0 0 0 0 0 0 0 0 0 0
barplot(
colSums(prop.table(sentimientos_df[,1:8])),
space = 0.2,
horiz = FALSE,
las = 1,
cex.names = 0.7,
col = brewer.pal(n=8, name ="Set3"),
main = "Análisis de Sentimientos del Himno Nacional Mexicano",
xlab = "Emociones"
)
### Profundizar
análisis
palabras_fear <- texto_palabras[sentimientos_df$fear >0]
palabras_fear_orden <- sort(table(unlist(palabras_fear)),decreasing=TRUE)
head(palabras_fear_orden, n=10)##
## guerra sangre golpe guerrero metralla destino dios enemigo
## 8 4 2 2 2 1 1 1
## grito impotente
## 1 1