{"id":191076,"date":"2023-05-30T10:48:02","date_gmt":"2023-05-30T14:48:02","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=191076"},"modified":"2023-05-30T10:48:38","modified_gmt":"2023-05-30T14:48:38","slug":"creating-a-word-cloud-on-r-bloggers-posts","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/","title":{"rendered":"Creating a Word Cloud on R-bloggers Posts"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This post will go through how to create a word cloud of article titles scraped from the&nbsp;<a href=\"https:\/\/www.r-bloggers.com\/\">awesome R-bloggers<\/a>. Our goal will be to use R\u2019s&nbsp;<strong>rvest<\/strong>&nbsp;package to search through 50 successive pages on the site for article titles. The&nbsp;<strong>stringr<\/strong>&nbsp;and&nbsp;<strong>tm<\/strong>&nbsp;packages will be used for string cleaning and for creating a term document frequency matrix (with&nbsp;<strong>tm<\/strong>). We will then create a word cloud based off the words comprising these titles.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, we\u2019ll load the packages we need.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># load packages\nlibrary(rvest)\nlibrary(stringr)\nlibrary(tm)\nlibrary(wordcloud)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s write a function that will take a webpage as input and return all the scraped article titles.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">scrape_post_titles &lt;- function(site)\n{\n    # scrape HTML from input site\n    source_html &lt;- read_html(site)\n     \n    # grab the title attributes from link (anchor) tags within H2 header tags\n    titles &lt;- source_html %>% html_nodes(\"h2\") \n                          %>% html_nodes(\"a\") \n                          %>% html_attr(\"title\")\n     \n    # filter out any titles that are NA (where no title was found)\n    titles &lt;- titles[!is.na(titles)]\n     \n    # parse out just the article title (removing the words \"Permalink to \")\n    titles &lt;- gsub(\"Permalink to \", \"\", titles)\n \n    # return vector of titles\n    return(titles)\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The above function takes an input, called&nbsp;<em>site<\/em>, which will be the URL of a specific webpage on&nbsp;<a href=\"https:\/\/www.r-bloggers.com\/\">R-bloggers<\/a>. We then use&nbsp;<strong>rvest\u2019s<\/strong>&nbsp;<em>read_html<\/em>&nbsp;function to scrape the HTML from the webpage. Next, we parse out the titles by searching through the H2 tags, and parsing out the title attributes from the links within those header tags i.e. we search through each H2 tag, find the \u201ca\u201d tag (anchor, or link), and then pull the title from that tag.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The remaining code above is for cleaning up the titles we parsed. We take out any titles we parsed that are NA \u2013 i.e. any link tags that did not have a title attribute (these are not post titles). At this point, each of the title attributes we have has the words \u201cPermalink to \u201c. The&nbsp;<em>gsub<\/em>&nbsp;line of code is just getting rid of this in each title.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#filter out any titles that are NA (where no title was found)\ntitles &lt;- titles[!is.na(titles)]\n \n# parse out just the article title (removing the words \"Permalink to \")\ntitles &lt;- gsub(\"Permalink to \", \"\", titles)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let\u2019s get the vector of webpages we need to scrape. Each successive page containing article links has the following pattern:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u201chttps:\/\/www.r-bloggers.com\/page\/index\u201d<\/strong>&nbsp;where index is some positive integer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.r-bloggers.com\/page\/1\">https:\/\/www.r-bloggers.com\/page\/1<\/a><br><a href=\"https:\/\/www.r-bloggers.com\/page\/2\">https:\/\/www.r-bloggers.com\/page\/2<\/a><br><a href=\"https:\/\/www.r-bloggers.com\/page\/3\">https:\/\/www.r-bloggers.com\/page\/3<\/a><br><a href=\"https:\/\/www.r-bloggers.com\/page\/4\">https:\/\/www.r-bloggers.com\/page\/4<\/a><br><strong>\u2026<\/strong><br><strong>\u2026<\/strong><br><strong>\u2026<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thus, we can just use the&nbsp;<em>paste0<\/em>&nbsp;function to generate all the URLs we want.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">root &lt;- \"https:\/\/www.r-bloggers.com\/\"\n \n# get each webpage URL we need\nall_pages &lt;- c(root, paste0(root, \"page\/\", 2:50))<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, let\u2019s scrape the post titles from each webpage using our&nbsp;<em>scrape_post_titles<\/em>&nbsp;function. Then, we\u2019ll collapse the titles into a single vector.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># use our function to scrape the title of each post\nall_titles &lt;- lapply(all_pages, scrape_post_titles)\n \n# collapse the titles into a vector\nall_titles &lt;- unlist(all_titles)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After we have the titles scraped, we need to perform some cleaning operations, such as converting each title to lowercase, and getting rid of numbers, punctuation, and&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Stop_words\">stop words<\/a>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">## Clean up the titles vector\n#############################\n \n# convert all titles to lowercase\ncleaned &lt;- tolower(cleaned)\n \n# remove any numbers from the titles\ncleaned &lt;- removeNumbers(cleaned)\n \n# remove English stopwords\ncleaned &lt;- removeWords(cleaned, stopwords(\"en\"))\n \n# remove punctuation\ncleaned &lt;- removePunctuation(cleaned)\n \n# remove spaces at the beginning and end of each title\ncleaned &lt;- str_trim(cleaned)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we use the&nbsp;<strong>tm<\/strong>&nbsp;package to convert our cleaned vector of titles to a corpus. On the next line, we&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Stemming\">stem each word<\/a>&nbsp;in the titles to get the root of each word (e.g. model, models, and modeling will each count as the same word, model).<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># convert vector of titles to a corpus\ncleaned_corpus &lt;- Corpus(VectorSource(cleaned))\n \n# steam each word in each title\ncleaned_corpus &lt;- tm_map(cleaned_corpus, stemDocument)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">With the cleaned corpus, we can get a term document matrix. This will give us a frequency of how often each word occurs.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">doc_object &lt;- TermDocumentMatrix(cleaned_corpus)\ndoc_matrix &lt;- as.matrix(doc_object)\n \n# get counts of each word\ncounts &lt;- sort(rowSums(doc_matrix),decreasing=TRUE)\n \n# filter out any words that contain non-letters\ncounts &lt;- counts[grepl(\"^[a-z]+$\", names(counts))]\n \n# create data frame from word frequency info\nframe_counts &lt;- data.frame(word = names(counts), freq = counts)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Lastly, we use the&nbsp;<strong>wordcloud<\/strong>&nbsp;package to generate a word cloud based off the words across all the titles.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">set.seed(1000)\nwordcloud(words = frame_counts$word, freq = frame_counts$freq, min.freq = 1,\n          max.words=200, random.order=FALSE, rot.per=0.2, \n          colors=brewer.pal(8, \"Dark2\"))<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"640\" height=\"611\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/05\/r-bloggers-word-cloud-theautomatic-net.jpg\" alt=\"\" class=\"wp-image-191085 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/05\/r-bloggers-word-cloud-theautomatic-net.jpg 640w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/05\/r-bloggers-word-cloud-theautomatic-net-300x286.jpg 300w\" data-sizes=\"(max-width: 640px) 100vw, 640px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 640px; aspect-ratio: 640\/611;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Above, we can see that \u201cdata\u201d is the most popular word. Variations of \u201cmodel\u201d, \u201canalysis\u201d, and \u201cpackage\u201d are also popular.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Originally posted on <a href=\"https:\/\/theautomatic.net\/2019\/01\/29\/creating-a-word-cloud-on-r-bloggers-posts\/\">TheAutomatic.net<\/a> blog.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post will go through how to create a word cloud of article titles scraped from the\u00a0awesome R-bloggers. <\/p>\n","protected":false},"author":388,"featured_media":132255,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[339,343,338,341,342],"tags":[806,487,15354,6591,14987,15352,1940,8225,15353],"contributors-categories":[13695],"class_list":["post-191076","post","type-post","status-publish","format-standard","has-post-thumbnail","category-data-science","category-programing-languages","category-ibkr-quant-news","category-quant-development","category-r-development","tag-data-science","tag-r","tag-r-bloggers","tag-rstats","tag-rvest","tag-stringr","tag-tm","tag-word-cloud","tag-wordcloud","contributors-categories-theautomatic-net"],"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v28.1) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Creating a Word Cloud on R-bloggers Posts | IBKR Quant<\/title>\n<meta name=\"description\" content=\"This post will go through how to create a word cloud of article titles scraped from the\u00a0awesome R-bloggers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/191076\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating a Word Cloud on R-bloggers Posts | IBKR Campus US\" \/>\n<meta property=\"og:description\" content=\"This post will go through how to create a word cloud of article titles scraped from the\u00a0awesome R-bloggers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-30T14:48:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-30T14:48:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/04\/data-science-quant.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Andrew Treadway\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andrew Treadway\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Andrew Treadway\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/d4018570a16fb867f1c08412fc9c64bc\"\n\t            },\n\t            \"headline\": \"Creating a Word Cloud on R-bloggers Posts\",\n\t            \"datePublished\": \"2023-05-30T14:48:02+00:00\",\n\t            \"dateModified\": \"2023-05-30T14:48:38+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/\"\n\t            },\n\t            \"wordCount\": 526,\n\t            \"commentCount\": 1,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/data-science-quant.jpg\",\n\t            \"keywords\": [\n\t                \"Data Science\",\n\t                \"R\",\n\t                \"R-bloggers\",\n\t                \"rstats\",\n\t                \"rvest\",\n\t                \"stringr\",\n\t                \"TM\",\n\t                \"Word Cloud\",\n\t                \"wordcloud\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Quant\",\n\t                \"Quant Development\",\n\t                \"R Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/\",\n\t            \"name\": \"Creating a Word Cloud on R-bloggers Posts | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/data-science-quant.jpg\",\n\t            \"datePublished\": \"2023-05-30T14:48:02+00:00\",\n\t            \"dateModified\": \"2023-05-30T14:48:38+00:00\",\n\t            \"description\": \"This post will go through how to create a word cloud of article titles scraped from the\u00a0awesome R-bloggers.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/creating-a-word-cloud-on-r-bloggers-posts\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/data-science-quant.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/data-science-quant.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Data Science\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/d4018570a16fb867f1c08412fc9c64bc\",\n\t            \"name\": \"Andrew Treadway\",\n\t            \"description\": \"Andrew Treadway currently works as a Senior Data Scientist, and has experience doing analytics, software automation, and ETL. He completed a master\u2019s degree in computer science \\\/ machine learning, and an undergraduate degree in pure mathematics. Connect with him on LinkedIn: https:\\\/\\\/www.linkedin.com\\\/in\\\/andrew-treadway-a3b19b103\\\/In addition to TheAutomatic.net blog, he also teaches in-person courses on Python and R through my NYC meetup: more details.\",\n\t            \"sameAs\": [\n\t                \"https:\\\/\\\/theautomatic.net\\\/about-me\\\/\"\n\t            ],\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/andrewtreadway\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Creating a Word Cloud on R-bloggers Posts | IBKR Quant","description":"This post will go through how to create a word cloud of article titles scraped from the\u00a0awesome R-bloggers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/191076\/","og_locale":"en_US","og_type":"article","og_title":"Creating a Word Cloud on R-bloggers Posts | IBKR Campus US","og_description":"This post will go through how to create a word cloud of article titles scraped from the\u00a0awesome R-bloggers.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/","og_site_name":"IBKR Campus US","article_published_time":"2023-05-30T14:48:02+00:00","article_modified_time":"2023-05-30T14:48:38+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/04\/data-science-quant.jpg","type":"image\/jpeg"}],"author":"Andrew Treadway","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Andrew Treadway","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/"},"author":{"name":"Andrew Treadway","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/d4018570a16fb867f1c08412fc9c64bc"},"headline":"Creating a Word Cloud on R-bloggers Posts","datePublished":"2023-05-30T14:48:02+00:00","dateModified":"2023-05-30T14:48:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/"},"wordCount":526,"commentCount":1,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/04\/data-science-quant.jpg","keywords":["Data Science","R","R-bloggers","rstats","rvest","stringr","TM","Word Cloud","wordcloud"],"articleSection":["Data Science","Programming Languages","Quant","Quant Development","R Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/","name":"Creating a Word Cloud on R-bloggers Posts | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/04\/data-science-quant.jpg","datePublished":"2023-05-30T14:48:02+00:00","dateModified":"2023-05-30T14:48:38+00:00","description":"This post will go through how to create a word cloud of article titles scraped from the\u00a0awesome R-bloggers.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/creating-a-word-cloud-on-r-bloggers-posts\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/04\/data-science-quant.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/04\/data-science-quant.jpg","width":1000,"height":563,"caption":"Data Science"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/d4018570a16fb867f1c08412fc9c64bc","name":"Andrew Treadway","description":"Andrew Treadway currently works as a Senior Data Scientist, and has experience doing analytics, software automation, and ETL. He completed a master\u2019s degree in computer science \/ machine learning, and an undergraduate degree in pure mathematics. Connect with him on LinkedIn: https:\/\/www.linkedin.com\/in\/andrew-treadway-a3b19b103\/In addition to TheAutomatic.net blog, he also teaches in-person courses on Python and R through my NYC meetup: more details.","sameAs":["https:\/\/theautomatic.net\/about-me\/"],"url":"https:\/\/www.interactivebrokers.com\/campus\/author\/andrewtreadway\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/04\/data-science-quant.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/191076","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/388"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=191076"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/191076\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/132255"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=191076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=191076"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=191076"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=191076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}