Hi there
There are code from my kaggle notebook.
In my question, I mean the output just shows for me only 1 wordcloud2 html format although I use wordcloud2 function many times
---
title: "Text_mining_cartoon"
author: "Nguyen_LSCM"
date: "April 15 2020"
output:
flexdashboard::flex_dashboard:
vertical_layout: scroll
theme: yeti
---
Hi I am just a second year student. I learn these great things by myself, so please to give me more suggestions if you find any problems with my kernel.
Also, Please to upvote if you like my kernel
``` {js}
// Inverse color of navigation bar.
$('.navbar-inverse').removeClass('navbar-inverse').addClass('navbar-default');
```
```{r, include=FALSE}
library(tidyverse)
library(tidyr)
library(tidytext)
library(widyr)
library(scales)
library(wordcloud2)
library(wordcloud)
library(RColorBrewer)
library(rjson)
library(reshape2)
library(purrr)
library(plotly)
```
```{r include=FALSE}
txt<-read.csv("../input/RickAndMortyScripts.csv",header=TRUE)
colnames(txt)<-c("index","season","episode.code","episode.name","name","line")
```
<style>
.colored {
background-color: #FAFAFA;
}
</style>
Overview
=======================================================
Column {.tabset .tabset-fade data-width=500 .colored }
-----------------------------------------------------------------------
### Wordcloud {.no-padding}
```{r}
txt_pr<- txt%>% mutate(line=as.character(line))%>%unnest_tokens(output = word,input=line)%>%anti_join(stop_words)%>%filter(!word %in% c("iâ","hey","donâ","â","â"))
txt_gam_count<-txt_pr%>%group_by(word)%>%summarise(freq=n())
m<-wordcloud2(txt_gam_count,size=12,backgroundColor = "lightgreen",shape="star")
m
m
```
### Sentiment {.no-padding}
```{r}
txt_pr<-txt%>% mutate(line=as.character(line))%>%unnest_tokens(output = word,input=line)%>%group_by(word)%>%count(sort=TRUE)%>%inner_join(get_sentiments("bing"))
txt_pr%>%acast(word~sentiment,value.var="n",fill=0)%>%comparison.cloud(title.size = 4,title.colors = c("red","blue"),max.words = 200,colors = brewer.pal(6,"Set1"),match.colors = TRUE,title.bg.colors = "white")
```
Column {.tabset .tabset-fade data-width=500 .colored }
-----------------------------------------------------------------------
### Three seasons {.no-padding}
```{r}
txt_pr<- txt%>% mutate(line=as.character(line))%>%unnest_tokens(output = word,input=line)%>%anti_join(stop_words)%>%filter(!word %in% c("iâ","hey","donâ","â","â"))
txt_gam_count<-txt_pr%>%group_by(season,word)%>%summarise(freq=n())
txt_gam_count%>%ungroup()%>%mutate(season=fct_recode(factor(season),"season 1"="1","season 2"="2","season 3"="3"))%>%acast(word~season,value.var = "freq",fill=0)%>%comparison.cloud(random.order=FALSE,
colors = c("#00B2FF", "#FF0099", "#6600CC"),
title.size=1.5, max.words=300,title.colors = c("#00B2FF", "#FF0099", "#6600CC"))
```
### Bar_plot for each season {.no-padding}
```{r}
bar<- list()
txt_pr<- txt%>% mutate(line=as.character(line))%>%unnest_tokens(output = word,input=line)%>%anti_join(stop_words)%>%filter(!word %in% c("iâ","hey","donâ","â","â"))
bar_plot<-function(number){
bar<- txt_pr%>%filter(season==number)%>%group_by(season)%>%count(word,sort=TRUE)%>%head(15)
}
bar<-map(c(1,2,3),bar_plot)
df<-bind_rows(bar[1],bar[2],bar[3])%>%mutate(word=str_to_title(fct_reorder2(word,season,desc(n))))
gg<-df%>%ggplot(aes(x=fct_reorder2(word,season,desc(n)),y=n))+geom_bar(stat="identity",aes(fill=as.factor(season)))+theme_minimal()+scale_fill_manual(values=c("red","green","steelblue"))+facet_wrap(~season,nrow=3,scales = "free")+labs(title="Top words in each season","Scale_x_with_log10")+xlab("Number of frequency")+ylab("Word")+coord_flip()+scale_y_log10()+theme(legend.title=element_blank())
ggplotly(gg)
```
Character
========================================================================
Column {data-width=250}
-----------------------------------------------------------------------
### Rick scrips {.no-padding}
```{r}
txt_pr<- txt%>% mutate(line=as.character(line))%>%unnest_tokens(output = word,input=line)%>%anti_join(stop_words)%>%filter(!word %in% c("iâ","hey","donâ","â","â"))%>%filter(name %in% c("Rick","Morty","Beth","Jerry"))
txt_gam_count<-txt_pr%>%filter(name=="Rick")%>%group_by(word)%>%summarise(freq=n())
m<-wordcloud2(txt_gam_count,size = 12,backgroundColor = "pink",color = "white",shape = "star")
m
m
```
Column {data-width=250}
-----------------------------------------------------------------------
### Morty scrips {.no-padding}
```{r}
txt_gam_count<-txt_pr%>%filter(name=="Morty")%>%group_by(word)%>%summarise(freq=n())
m<-wordcloud2(txt_gam_count,size = 12,backgroundColor = "lightred",color = "white",shape = "circle")
m
m
```
Column {data-width=250}
-----------------------------------------------------------------------
### Beth scrips {.no-padding}
```{r}
txt_gam_count<-txt_pr%>%filter(name=="Beth")%>%group_by(word)%>%summarise(freq=n())
m<-wordcloud2(txt_gam_count,size = 12,backgroundColor = "lightblue",color = "white",shape = "triangle")
m
m
```
Column scrips{data-width=250}
-----------------------------------------------------------------------
### Jerry {.no-padding}
```{r}
txt_gam_count<-txt_pr%>%filter(name=="Jerry")%>%group_by(word)%>%summarise(freq=n())
m<-wordcloud2(txt_gam_count,size = 12,backgroundColor = "lightorchid",color = "white",shape = "diamond")
m
m
```