fingertipsR icon indicating copy to clipboard operation
fingertipsR copied to clipboard

Fingertips metadata wordcloud

Open julianflowers opened this issue 7 years ago • 0 comments

Bit of fun - a word cloud of fingertips metadata

` ftips_cloud <- function(){

library(fingertipsR) library(tidyverse) library(tidytext) library(stringr) library(wordcloud2)

profid <- profiles() %>% filter(!ProfileID %in% c(46, 108, 109, 110, 111, 116, 137))

meta <- indicator_metadata(ProfileID = profid$ProfileID) %>% janitor::clean_names()

meta1 <- meta %>% select(indicatorid, indicator_full_name, definition) %>% mutate(text = str_c(indicator_full_name, definition))

wc <- meta1 %>% unnest_tokens(bigram, text, token = "ngrams", n = 2) %>% count(bigram, sort = TRUE) %>% separate(bigram, c("w1", "w2"), sep = " ") %>% filter(!w1 %in% stop_words$word) %>% filter(!w2 %in% stop_words$word) %>% unite(bigram, w1, w2, sep = " ") %>% wordcloud2()

wc

}

`

julianflowers avatar Sep 19 '17 20:09 julianflowers