| $A$2 | The column and the row do not change when copied. |
|---|---|
| A$2 | The row does not change when copied. |
| $A2 | The column does not change when copied. |
Text mining is the process of extracting information and insights from unstructured text.
Pros - Universally available - Not going anywhere - Low barrier to entry - Scales in complexity
:::
:::
Cons - Can be difficult to reproduce - Potentially destructive - Doesn’t scale well - Limited options for text mining
:::
::::
=VLOOKUP(Value to look up, Range to look for value, Column for the return value, Type of match)
=VLOOKUP(A1, Lookup!A1:B7, 2, TRUE)
Relative references can move.
A1
Absolute references can’t move.
$A$1
| $A$2 | The column and the row do not change when copied. |
|---|---|
| A$2 | The row does not change when copied. |
| $A2 | The column does not change when copied. |
=COUNTIF(Where are we looking?, What are we looking for?)
=COUNTIF(A:A, “Washington”)
Warning
Assume that everything you put into ChatGPT (or other LLMs) is public. Do not enter confidential or proprietary information into it.
Tell ChatGPT what is is you need assistance with:
Source: ChatGPT
=IF(SUMPRODUCT(–ISNUMBER(SEARCH(Keywords_Range, Cell)))>0, “Found”, “Not Found”)
=IF(SUMPRODUCT(–ISNUMBER(SEARCH(Keywords_Range, Cell)))>0, “Found”, “Not Found”)
Keywords_Range with the actual range of keywords you want to search for. For example, if your keywords are in cells A1 to A10, the range would be A1:A10.=IF(SUMPRODUCT(–ISNUMBER(SEARCH(Keywords_Range, Cell)))>0, “Found”, “Not Found”)
Cell with the cell reference of the cell in the column you want to search. This is the cell where you want to check if any of the keywords are present. For example, if you want to search in column B, and the first cell is B2, you would use B2 as the cell reference.Source: ChatGPT
=IF(SUMPRODUCT(–ISNUMBER(SEARCH(Keywords_Range, Cell)))>0, “Found”, “Not Found”)
The formula will return “Found” if any of the keywords in the range are found in the specified cell, and “Not Found” if none of the keywords are found.
Note: This formula is case-insensitive, so it will match keywords regardless of their case. If you want case-sensitive matching, you can use the FIND function instead of SEARCH in the formula.
Tip
Everything in this workshop can be done through the virtual project. Scan the QR code to get started.



tidyverse
tidyverse vs ‘Base R’
Source: dplyr base R
tidytext
42,656 reviews from Disney California, Hong Kong, and Paris

Source: Kaggle
Rows: 42,656
Columns: 6
$ Review_ID <dbl> 670772142, 670682799, 670623270, 670607911, 67060729…
$ Rating <dbl> 4, 4, 4, 4, 4, 3, 5, 3, 2, 5, 5, 5, 4, 5, 5, 3, 4, 3…
$ Year_Month <chr> "2019-4", "2019-5", "2019-4", "2019-4", "2019-4", "2…
$ Reviewer_Location <chr> "Australia", "Philippines", "United Arab Emirates", …
$ Review_Text <chr> "If you've ever been to Disneyland anywhere you'll f…
$ Branch <chr> "Disneyland_HongKong", "Disneyland_HongKong", "Disne…
[1] "This place is HUGE! Definately need more than one day. We had 3 children aged 11, 9 & 6 and they loved it. A great variety of rides and attractions for all ages. Food options were fantastic with 3D models of what you were ordering. Staff were fantastic, very helpful. An awesome family experience."
# A tibble: 1 × 2
line text
<dbl> <chr>
1 1 This place is HUGE! Definately need more than one day. We had 3 childre…
# A tibble: 53 × 2
line word
<dbl> <chr>
1 1 this
2 1 place
3 1 is
4 1 huge
5 1 definately
6 1 need
7 1 more
8 1 than
9 1 one
10 1 day
# ℹ 43 more rows
# A tibble: 6 × 2
word n
<chr> <int>
1 were 3
2 and 2
3 fantastic 2
4 of 2
5 11 1
6 3 1
# A tibble: 6 × 2
word n
<chr> <int>
1 fantastic 2
2 11 1
3 3 1
4 3d 1
5 6 1
6 9 1
# A tibble: 6 × 3
Park linenumber text
<chr> <int> <chr>
1 California 1 This place has always been and forever will be special.…
2 California 2 A great day of simple fun and thrills. Bring cash, noth…
3 California 3 All and all a great day was had. The crowds are huge an…
4 California 4 Having been to the Florida location numerous times over…
5 California 5 Had the 4 day pass, spent 3 at DL and one at CA. Great …
6 California 6 Oh my god you can really forget your self and enjoy eve…
# A tibble: 6 × 3
Park linenumber word
<chr> <int> <chr>
1 California 1 forever
2 California 1 special
3 California 1 feeling
4 California 1 entering
5 California 1 park
6 California 1 characters
# A tibble: 6 × 2
word n
<chr> <int>
1 park 44557
2 disney 36187
3 rides 34508
4 disneyland 32935
5 time 29432
6 day 28332
n words# Unnest into bigrams
tidy_bigrams <- reviews %>%
unnest_tokens(bigram, text, token = "ngrams", n = 2) %>%
filter(!is.na(bigram))
# Separate words
tidy_bigrams <- tidy_bigrams %>%
separate(bigram, c("word1", "word2"), sep = " ")
# Remove stop words
tidy_bigrams <- tidy_bigrams %>%
filter(!word1 %in% stop_words$word) %>%
filter(!word2 %in% stop_words$word)
# Reunite terms
tidy_bigrams <- tidy_bigrams %>%
unite(bigram, word1, word2, sep = " ")# A tibble: 6 × 3
# Groups: Park [3]
Park bigram n
<chr> <chr> <int>
1 California fast pass 3123
2 Hong Kong hong kong 3025
3 Paris disneyland paris 2932
4 California california adventure 2293
5 Paris fast pass 1940
6 California disney world 1926
An introduction using the ‘joy’ sentiment.
# A tibble: 6 × 2
word sentiment
<chr> <chr>
1 absolution joy
2 abundance joy
3 abundant joy
4 accolade joy
5 accompaniment joy
6 accomplish joy
# A tibble: 6 × 2
word n
<chr> <int>
1 food 14322
2 fun 9952
3 parade 8468
4 love 5967
5 magical 5190
6 enjoy 4807
# A tibble: 6 × 5
Park index negative positive sentiment
<chr> <dbl> <int> <int> <int>
1 California 0 144 313 169
2 California 1 174 310 136
3 California 2 149 340 191
4 California 3 143 283 140
5 California 4 170 399 229
6 California 5 123 266 143

Related to this Workshop
Other R Links
matt.farrow@childrens.com