Documentos de Académico
Documentos de Profesional
Documentos de Cultura
matricula:20211123
Fecha: 27-2-2021
hora: 11:50 pm
Profesor: Bismark montero
Materia: ciencia y analítica en datos
Procedimiento realizado.
# limpiamos el workspace
rm(list = ls())
# Limpiamos la consola
cat("\014")
# fijamos a UTF-8
options(encoding = "utf-8")
#########################
# 1. Librerias
library(pdftools)
library(dplyr)
library(stopwords)
library(tidytext)
library(stringi)
library(stringr)
library(ggplot2)
library(scales)
library(tidyr)
library(widyr)
library(ggraph)
library(igraph)
library(quanteda)
library(topicmodels)
library(cvTools)
########################
# directorio de trabajo
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
getwd()
texto01[1]
length(texto01)
length(texto02)
# limpieza de texto
length(texto)
texto[1]
# estructurar el texto
vector = c()
for(i in 1:length(texto)){
temp<-(strsplit(texto[[i]], "\\.")[[1]])
print(temp)
# dataframe
frases_texto<-as.data.frame(vector)
#####################################
# 3. Limpieza de texto
# limpieza manual
colnames(frases_texto)[1]<-"frase"
# Convertimos a caracter
frases_texto$frase <-as.character(frases_texto$frase)
# limpieza de texto
frases_texto$frase<-gsub("PRIMERA PARTE","",frases_texto$frase)
#####################################
lexiconSW<-stopwords("es")
names(lexiconSW)<-"word"
lexiconSW$word<-as.character(lexiconSW$word)
anti_join(lexiconSW) %>% # devuelve todas las filas de x donde no hay valores coincidentes
en y, manteniendo solo columnas de x.
group_by(word) %>%
word_counts %>%
head(40) %>%
ggplot(aes(word, n)) +
geom_col(fill = "blue") +
scale_y_continuous(labels = comma_format()) +
coord_flip() +
x = "Palabra",
library(wordcloud)
library(RColorBrewer)
# Generamos el wordcloud