This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Cmd+Shift+Enter.
This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Cmd+Shift+Enter.
Install necessary packages. Comment after installation
#install.packages('tm')
#install.packages('RColorBrewer')
#install.packages('wordcloud')
Include the packages.
library('tm')
## Loading required package: NLP
library('RColorBrewer')
library('wordcloud')
Process data
entrepreneurshipData <- readRDS("entrepreneurship.RDS")
BreneData <- readRDS("BreneBrown.RDS")
Etweets <- entrepreneurshipData$text
Btweets <- BreneData$text
# swap out all non-alphanumeric characters
# Note that the definition of what constitutes a letter or a number or a punctuatution mark varies slightly depending upon your locale, so you may need to experiment a little to get exactly what you want.
# str_replace_all(tweets, "[^[:alnum:]]", " ")
# iconv(tweets, from = 'UTF-8', to = 'ASCII//TRANSLIT')
# Encoding(Etweets) <- "UTF-8"
# Function to clean tweets
clean.text = function(x)
{
# remove rt
x = gsub("rt", "", x)
# remove at
x = gsub("@\\w+", "", x)
# remove punctuation
x = gsub("[[:punct:]]", "", x)
# remove numbers
x = gsub("[[:digit:]]", "", x)
# remove links http
x = gsub("http\\w+", "", x)
# remove tabs
x = gsub("[ |\t]{2,}", "", x)
# remove blank spaces at the beginning
x = gsub("^ ", "", x)
# remove blank spaces at the end
x = gsub(" $", "", x)
# tolower
x = tolower(x)
return(x)
}
# clean tweets
Etweets = clean.text(Etweets)
Btweets = clean.text(Btweets)
# Word cloud section
corpus = Corpus(VectorSource(Etweets))
# create term-document matrix
tdm = TermDocumentMatrix(
corpus,
control = list(
wordLengths=c(3,20),
removePunctuation = TRUE,
stopwords = c("the", "a", stopwords("english")),
removeNumbers = TRUE,
# tolower may cause trouble on Window because UTF-8 encoding, changed to FALSE
tolower = FALSE) )
# convert as matrix. It may consume near 1g of your RAM
tdm = as.matrix(tdm)
# get word counts in decreasing order
word_freqs = sort(rowSums(tdm), decreasing=TRUE)
#check top 50 most mentioned words
head(word_freqs, 50)
## entrepreneurship business amp
## 3460 1245 960 762
## entrepreneurs will help can
## 595 592 475 437
## entrepreneur young new innovation
## 419 399 397 364
## now government know marketing
## 345 336 336 326
## fast grow
nigeria person
## 323 317 314 314
## staup social rtin appointment
## 310 310 310 304
## epitome think staups people
## 296 284 283 256
## get great women leadership
## 251 242 236 234
## success development join education
## 233 226 220 218
## someone entrepre
rtthe students
## 217 216 215 213
## youth inspired first like
## 212 209 208 206
## businesses sta time appeal
## 200 197 192 192
## lose one
## 192 190
#remove the top words which do not generate insights such as "the", "a", "and", etc.
#word_freqs = word_freqs[-(1:5)] #Here [-(1:5)] is 1st-5th words in the list we want to remove
#commented because in this case we want to keep the first to fifth words in the list
#create a data frame with words and their frequencies
dm = data.frame(word=names(word_freqs), freq=word_freqs)
#Plot corpus in a clored graph; need RColorBrewer package
wordcloud(head(dm$word, 50), head(dm$freq, 50), random.order=FALSE, colors=brewer.pal(8, "Dark2"))
## Warning in wordcloud(head(dm$word, 50), head(dm$freq, 50), random.order =
## FALSE, : entrepreneurship could not be fit on page. It will not be plotted.
#check top 50 most mentioned words
head(word_freqs, 50)
## entrepreneurship business amp
## 3460 1245 960 762
## entrepreneurs will help can
## 595 592 475 437
## entrepreneur young new innovation
## 419 399 397 364
## now government know marketing
## 345 336 336 326
## fast grow
nigeria person
## 323 317 314 314
## staup social rtin appointment
## 310 310 310 304
## epitome think staups people
## 296 284 283 256
## get great women leadership
## 251 242 236 234
## success development join education
## 233 226 220 218
## someone entrepre
rtthe students
## 217 216 215 213
## youth inspired first like
## 212 209 208 206
## businesses sta time appeal
## 200 197 192 192
## lose one
## 192 190
# I want more insight on the tweets about "youth"
index = grep("youth", Etweets)
Etweets[index]
## [1] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [2] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [3] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [4] "rtgreat consultation today about youth strategy for the tunisian <U+0001F1F9><U+0001F1F3> textile amp garment sector with <U+0001F4AF>suppo and ideas frard th
"
## [5] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [6] "deadline approaching apply for global youth summityour chance to be selected as a global changemaker
"
## [7] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [8] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [9] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [10] "rthuge congratulations to our business inspired students here at novi high school youth entrepreneurship is what were all abo
"
## [11] "rtbarriers to effective youth entrepreneurship and vocational education\nfor more information\n"
## [12] "currently youth unemployment isin southafrica\n\nwe need a dynamic culture of entrepreneurship in south afri
"
## [13] "one of the focus areas of the zachedo women and youth entrepreneurship program is financial literacy during these
"
## [14] "this is an oppounity for youth to come together explore the universality of hip hop and explore other elements
"
## [15] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [16] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [17] "radio broadcasting about challenges of youth entrepreneurship in togo on youth entrepreneurship offunded
"
## [18] "thank you nelson mandela university eastern cape and south africa forward and upward we go for student and youth
"
## [19] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [20] "rtmr jones aboriginal youth entrepreneurship class researching indigineous entrepreneurslater this semester they will cre
"
## [21] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [22] "rtour social entrepreneurship program changemakers academy is a youth work initiative of the year awarded by the min
"
## [23] "rtcome take a leeap with the ministry of spo and youth affairs\n\nthe leeap programme offers youth development training in li
"
## [24] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [25] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [26] "rtjobsforyouth \n\nbritish council ghana is providing free entrepreneurship and development training oppounities in the
"
## [27] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [28] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [29] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [30] "youthunemployment has become an international crisis expesand tommy galloway along with two yo
"
## [31] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [32] "edmonton has been recognized byas the best city in canada for youth to work inyeg was chos
"
## [33] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [34] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [35] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [36] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [37] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [38] "come take a leeap with the ministry of spo and youth affairs\n\nthe leeap programme offers youth development train
"
## [39] "rtmr jones aboriginal youth entrepreneurship class researching indigineous entrepreneurslater this semester they will cre
"
## [40] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [41] "mr jones aboriginal youth entrepreneurship class researching indigineous entrepreneurslater this semester they
"
## [42] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [43] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [44] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [45] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [46] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [47] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [48] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [49] "funded columbia university youth peace and security leadership program \n follow us for international oppo
"
## [50] "youthwithmodi\nto empower yuva shakti and make youthled development possible pm modi has a e approach educatio
"
## [51] "join us tonight at pm on the grind liberias only youth entrepreneurship tv show\npowered by yoner liber
"
## [52] "i always hope to inspire more youth from all walks of life to pursue agribusiness entrepreneurship thus i staed
"
## [53] "should swearing be used when giving talks\n\nwere modelling for youth sure but what is realistic modelling \n
"
## [54] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [55] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [56] "rthow can we help youth women migrants amp the unemployed set up their own business how can we boost the development of socia
"
## [57] "edmonton was chosen as the overall winner for youth to work based on its top ten finishes in four themes including
"
## [58] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [59] "rtclosing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific training amp en
"
## [60] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [61] "rtgreat consultation today about youth strategy for the tunisian <U+0001F1F9><U+0001F1F3> textile amp garment sector with <U+0001F4AF>suppo and ideas fr"
## [62] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [63] "jobsforyouth \n\nbritish council ghana is providing free entrepreneurship and development training oppounities in
"
## [64] "looking forward to an update call sholy with my colleagueslooking to make an impact with youth and entrepreneurship globally"
## [65] "rtclosing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific training amp en
"
## [66] "rtclosing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific training amp en
"
## [67] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [68] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [69] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [70] "your approach was wrong to recommend any companyits cronyism you have spos and youth ministry
"
## [71] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [72] "jobsforyouth \n\nbritishcouncil ghana is providing free entrepreneurship and development training oppounities i
"
## [73] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [74] "we want to empower one nigerian youth with a million naira to aid them in the sta up of their
"
## [75] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [76] "all pakistan youth organizing is hosting another exclusive event in collaboration with dha suffa university power
"
## [77] "all pakistan youth organizing is hosting another exclusive event in collaboration with dha suffa university power
"
## [78] "mce ugandas youth entrepreneurship awards featured in national media\nread more\n"
## [79] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [80] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [81] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [82] "rthuge congratulations to our business inspired students here at novi high school youth entrepreneurship is what were all abo
"
## [83] "what i think syedsaddiq should do with youth entrepreneurs is to gather them and execute a youth business mentorsh
"
## [84] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [85] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [86] "summit to bring african entrepreneurs together\nconnect circle a youthowned company will host its second insta
"
## [87] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [88] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [89] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [90] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [91] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [92] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [93] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [94] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [95] "rtreminder\n\ndear african youths who have a business idea or social venture or ngo please get in here and apply for the
"
## [96] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [97] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [98] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [99] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [100] "rta must watch \nour ceo steven shares our story of promoting stimulating and suppoing youth driven entrepreneurship
"
## [101] "rtpleased to see you again mohamed happy to move the dial closer towards our joint purpose of youth empowerment amp entrepre
"
## [102] "rti love pmb because his administration brought out the entrepreneurship in most nigerian youth damn we dey hustle baba car
"
## [103] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [104] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [105] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [106] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [107] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [108] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [109] "rtwhat i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentorship pro
"
## [110] "what i thinkshould do with youth entrepreneurs is to gather them and execute a youth business mentors
"
## [111] "rtbursaries for unemployed youth in cptage eager to study entrepreneurshipwhatsapp or callp
"
## [112] "barriers to effective youth entrepreneurship and vocational education\nfor more information\n"
## [113] "the main objective of skillindia mission is to skill youths in an innovative way so that they get employment throu
"
## [114] "ckn centre kram ngoy train youth people to electricity and automation training courses are on different subjects s
"
## [115] "we need a political pay for employment and entrepreneurship of the youth the youth is the future south africa a
"
## [116] "why we do what we dowhere are the youth going to go entrepreneurship is a natural paner wadhwani
"
## [117] "rtas the window for public paicipation opens inwe commit to pushing the youth agenda in matters health agri
"
## [118] "rthow do we respond to challenges such as youth unemployment or gender inequality\n\nthe british council sees promise in bri
"
## [119] "becoming a successful person in kenya is damn near impossible esp for the youth thejob enslaves
"
## [120] "rtclosing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific training amp en
"
## [121] "rtclosing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific training amp en
"
## [122] "rtclosing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific training amp en
"
## [123] "livetrainingyouth as champions and role models in agribusiness entrepreneurship and responsible i
"
## [124] "believes so much in the youth he sees nigerian youth as the labour force of this country and hes committed
"
## [125] "our social entrepreneurship program changemakers academy is a youth work initiative of the year awarded by the
"
## [126] "rta must watch presentation for youth in entrepreneurshipagribusiness youthinag youthindev agri
"
## [127] "nothing to add<U+0001F4A1><U+0001F331>\n\nhea intuition become stevejobseurshipagribusiness youthinag youthindev agri
"
## [128] "rtbursaries for unemployed youth in cptage eager to study entrepreneurshipwhatsapp or call
"
## [129] "rthow can we help youth women migrants amp the unemployed set up their own business how can we boost the development of socia
"
## [130] "rtclosing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific training amp en
"
## [131] "rtclosing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific training amp en
"
## [132] "bursaries for unemployed youth in cptage eager to study entrepreneurshipwhatsapp or callplz share"
## [133] "bursaries for unemployed youth in cptage eager to study entrepreneurshipwhatsapp or callplz share"
## [134] "bursaries for unemployed youth in cptage eager to study entrepreneurshipwhatsapp or call
"
## [135] "rtclosing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific training amp en
"
## [136] "youthwithmodi\nto empower yuva shakti and make youthled development possible pm modi has a e approach educatio
"
## [137] "edmonton ranked top city for youth to work firstever youthfulcities urban work index results show canadian citie
"
## [138] "rtparents in arlingtonva have a new summercamp for girls to explore business and entrepreneurship \n\n\nyouth enri
"
## [139] "rta must watch \nour ceo steven shares our story of promoting stimulating and suppoing youth driven entrepreneurship
"
## [140] "rtclosing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific training amp en
"
## [141] "closing today applications for kenya youth employment amp oppounities project kyeop cyclejob specific traini
"
## [142] "how to empower our youth for futureleadership and entrepreneurship\nhow to solve and create job opp
"
## [143] "rttheyouth entrepreneurship awards will be an annual event that willbe held every year to recognize outstanding you
"
## [144] "rtassam staup policyaims to create a culture of entrepreneurship by promoting and empowering youths to become jo
"
## [145] "siaya kipaji youth harvests bags of groundnuts which will be used to process peanut butter to finance the group p
"
## [146] "siaya kipaji youth harvests bags of groundnuts which will be used to process peanut butter to finance the group p
"
## [147] "sa youth empowerment strategyentrepreneurshipempowerment\n"
## [148] "rtwe need your suppo help us inspire and empower the youth of baltimore to be more than the statistics say
"
## [149] "theguardianbusiness in a bid to suppo government effos to reduce unemployment among youths halotel tanzania l
"
## [150] "rtwe need your suppo help us inspire and empower the youth of baltimore to be more than the statistics say
"
## [151] "rthuge congratulations to our business inspired students here at novi high school youth entrepreneurship is what were all abo
"
## [152] "we need your suppo help us inspire and empower the youth of baltimore to be more than the statis
"
## [153] "edmonton ranked top city for youth to work firstever youthfulcities urban work index results show canadian citie
"
## [154] "a must watch \nour ceo steven shares our story of promoting stimulating and suppoing youth driven entrepreneurs
"
## [155] "youthwithmodi\nto empower yuva shakti and make youthled development possible pm modi has a e approach educatio
"
## [156] "edmonton ranked top city for youth to work firstever youthfulcities urban work index results show canadian citie
"
## [157] "rthuge congratulations to our business inspired students here at novi high school youth entrepreneurship is what were all abo
"
## [158] "rtawesome work byampdetailing the gaps for attracting youth talent\n\nto service providersball is in
"
## [159] "rtthe uae <U+0001F1E6><U+0001F1EA> pledges usmillions for youth and women entrepreneurship in mali <U+0001F1F2>entrepreneurship in the
"
## [160] "a must watch presentation for youth in entrepreneurshipagribusiness youthinag
"
## [161] "awesome work byampdetailing the gaps for attracting youth talent\n\nto service providersball
"
## [162] "i love pmb because his administration brought out the entrepreneurship in most nigerian youth damn we dey hustle b
"
## [163] "rtas the window for public paicipation opens inwe commit to pushing the youth agenda in matters health agri
"
## [164] "youthwithmodi\nto empower yuva shakti and make youthled development possible pm modi has a e approach educatio
"
## [165] "rtyouth civic engagement is the cornerstone of s sahel regional programming check out our work suppoing youth
"
## [166] "so vele ama white kids dont have success stories we only hear about the black youth making breakthroughs in entre
"
## [167] "youth entrepreneur wins full scholarship to rider universitygoogleales
"
## [168] "edmonton ranked top city for youth to work firstever youthfulcities urban work index results show canadian citie
"
## [169] "future prospects is airing nowits a show about youth entrepreneurship and inspiration tune in nowrogerstv"
## [170] "douglas county students invited to paicipate in youth entrepreneurship challenge"
## [171] "rthow do we respond to challenges such as youth unemployment or gender inequality\n\nthe british council sees promise in bri
"
## [172] "our global youth entrepreneurship summit will showcase the best in innovation entrepreneurship suppo and new mod
"
## [173] "huge congratulations to our business inspired students here at novi high school youth entrepreneurship is what we
"
## [174] "rtabillion zar youthjobsfund focusing on ent
"
## [175] "check out this great aicle douglas county students invited to paicipate in youth entrepreneurship challenge"
## [176] "pm modi announces launch of entrepreneurship cells in collegesyouth incorporated pm modi announces launch of en
"
## [177] "rtthe state dept for youth in conjunction with the chandaria foundation will tomorrow hostyouth to an award ceremony foll
"
## [178] "rtas oppounityyouth continue to struggle to connect to the economy entrepreneurship offers them a chance to learn the ski
"
## [179] "in december we held another entrepreneurship training course for ekaris college graduates through our youth
"
## [180] "edmonton ranked top city for youth to work firstever youthfulcities urban work index results show canadian citie
"
## [181] "rtnowplaying on radio future africastrive masiyiwacreating wakanda youth technology and entrepreneurship across afri
"
## [182] "as oppounityyouth continue to struggle to connect to the economy entrepreneurship offers them a chance to learn
"
## [183] "rtskilling more thancr youth amp driving entrepreneurship through initiatives like mudrayojana staupindia amp standupin
"
## [184] "rtskilling more thancr youth amp driving entrepreneurship through initiatives like mudrayojana staupindia amp standupin
"
## [185] "rtoppounityyouth themillion young people who are neither in work nor in school often encounter significant barriers
"
## [186] "rtpleased to see you again mohamed happy to move the dial closer towards our joint purpose of youth empowerment amp entrepre
"
## [187] "youthwithmodi\nto empower yuva shakti and make youthled development possible pm modi has a e approach educatio
"
## [188] "chatswre risingyouth conference focused on entrepreneurship for peoples with disabil
"
## [189] "oppounityyouth themillion young people who are neither in work nor in school often encounter significant
"
Bigram
library(dplyr)
##
## 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(tidyverse) # data manipulation & plotting
## -- Attaching packages ---------------------------------------------------------------------------- tidyverse 1.2.1 --
## v ggplot2 3.1.0 v readr 1.3.1
## v tibble 2.0.1 v purrr 0.3.0
## v tidyr 0.8.2 v stringr 1.3.1
## v ggplot2 3.1.0 v forcats 0.3.0
## -- Conflicts ------------------------------------------------------------------------------- tidyverse_conflicts() --
## x ggplot2::annotate() masks NLP::annotate()
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(stringr) # text cleaning and regular expressions
library(tidytext) # provides additional text mining functions
titles <- c("Ent", "Brene")
books <- list(Etweets, Btweets)
series <- tibble()
# for(i in seq_along(titles)) {
for(i in 1) {
clean <- tibble(chapter = seq_along(books[[i]]),
text = books[[i]]) %>%
# Number of gram
unnest_tokens(bigram, text, token = "ngrams", n = 2) %>%
mutate(book = titles[i]) %>%
select(book, everything())
series <- rbind(series, clean)
}
# series
series %>%
count(bigram, sort = TRUE)
## # A tibble: 46,237 x 2
## bigram n
## <chr> <int>
## 1 is a 477
## 2 in the 412
## 3 for a 376
## 4 not a 316
## 5 fast grow 311
## 6 a fast 309
## 7 of the 307
## 8 a young 305
## 9 if you 302
## 10 appointment not 298
## # ... with 46,227 more rows
series %>%
separate(bigram, c("word1", "word2"), sep = " ") %>%
filter(!word1 %in% stop_words$word,
!word2 %in% stop_words$word) %>%
count(word1, word2, sort = TRUE)
## # A tibble: 16,663 x 3
## word1 word2 n
## <chr> <chr> <int>
## 1 fast grow 311
## 2 government appointment 297
## 3 rtin nigeria 294
## 4 vijay mallya 185
## 5 rtdear vijay 184
## 6 skill development 155
## 7 development amp 146
## 8 natural gas 145
## 9 amp natural 144
## 10 petroleum amp 144
## # ... with 16,653 more rows
#Most of the words in the bigram for Brene Brown are from a popular quote of hers, indicating the values of being "brave, awkward, and kind". She also pushes for showing more vulnerability in leadership.
#The entrepreneurship words express values shared by entrepreneurs such as growth, youth, innovation, and includes a lot of things about regions of Africa where there are growing entrepreneurship movements.
Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Cmd+Option+I.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Cmd+Shift+K to preview the HTML file).
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.