Estou Tentando Criar Uma Tabela Que Tenha Como Base o Capitulo-Livro-Sentimento-n deixando o Capitulo sempre na ordem original:"The Boy Who Lived", "The Vanishing Glass", "The Letters from No One", "The Keeper of Keys", "Diagon Alley", "The Journey from Platform Nine and Three Quarters", "The Sorting Hat", "The Potions Master", "The Midnight Duel", "Halloween", "Quidditch", "The Mirror of Erised", "Nicholas Flamel", "Norbert the Norwegian Ridgeback", "The Forbidden Forest", "Through the Trapdoor", "The Man with Two Faces"
So que ao fazer esssa tabela o capitulo ele se ordena por ordem alfabetica.Já Tentei dar sort=FALSE no count mas nada funciona....
Estou fazendo assim:
cap=c("The Boy Who Lived",
"The Vanishing Glass",
"The Letters from No One",
"The Keeper of Keys",
"Diagon Alley",
"The Journey from Platform Nine and Three Quarters",
"The Sorting Hat",
"The Potions Master",
"The Midnight Duel",
"Halloween",
"Quidditch",
"The Mirror of Erised",
"Nicholas Flamel",
"Norbert the Norwegian Ridgeback",
"The Forbidden Forest",
"Through the Trapdoor",
"The Man with Two Faces")
PedraFilosofal = tibble(Capitulo = cap,
Texto = philosophers_stone,
Livro = "PedraFilosofal")
LetraPF = PedraFilosofal %>%
group_by(Capitulo,Livro) %>%
unnest_tokens(Letra,Texto)
SemSWPF = LetraPF %>%
anti_join(stop_words,by=c("Letra"="word"))
TabelaSentimentosCap = SemSWPF %>%
inner_join(get_sentiments("bing"),by = c("Letra" = "word")) %>%
count(Livro,sentiment) %>%
spread(sentiment,n,fill=0) %>%
mutate(Sentimento = positive-negative)
Estou Usando O Pacote Tidytext e Tidyverse,sem contar o do Harry Potter q tirei do gitgub.