Skip to content

Commit

Permalink
Update sm script
Browse files Browse the repository at this point in the history
  • Loading branch information
cforgaci committed Mar 19, 2024
1 parent 7fdb376 commit 73706ed
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions script_socialmedia.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ include-in-header:
---

::: callout-note
After analysing the Dutch news data, if you still have interests in working social media data and to hear more about citizen voice, you can follow the documents to do the very similar things. If you are reading the source document `script_socialmedia.qmd` and want to see a rendered version of it, click on the Render button above this window.
If you are reading the source document `script_socialmedia.qmd` and want to see a rendered version in your browser, click on the Render button above this window.
:::

## Setup
Expand All @@ -47,7 +47,7 @@ During the workshop, we work with [Web Data Research Assistant](https://southamp

4. Press <kbd>Shift</kbd>+<kbd>Ctrl</kbd>+<kbd>H</kbd> to halt the data gathering process and stop the browser scrolling. You will be prompted to save a `WebDataRE.html` file. ![](fig/webscraping2.png)

5.Open the `WebDataRE.html`, select the data in the table (including the column headers), open a new Excel file and paste the copied data into it. ![](fig/webscraping3.png)
5. Open the `WebDataRE.html`, select the data in the table (including the column headers), open a new Excel file and paste the copied data into it. ![](fig/webscraping3.png)

### Software for analysing data

Expand Down Expand Up @@ -80,11 +80,11 @@ library(tm) # Create and manipulate corpora

## Introduction

In this workshop, we will use word clouds to reveal top keywords in the facebook or x about farmer communities.
In this workshop, we will use word clouds to reveal top keywords in the Facebook or X about farmer communities.

### The dataset

We will do this together on a given dataset: two data frames of excel files which generated by Web Data Research Assistant and translated by Google. The one is from facebook and another is from x. In this instruction, we will work with data frames of social media x. After that, you will run the analysis in this document on a dataset of your choice. Run the following code chunk with the default value.
We will do this together on a given dataset: two data frames of Excel files which generated by Web Data Research Assistant and translated by Google. The one is from Facebook and another is from X. In this instruction, we will work with data frames of social media X. After that, you will run the analysis in this document on a dataset of your choice. Run the following code chunk with the default value.

```{r}
# What data will you work with? Use one of the following two values:
Expand All @@ -95,7 +95,7 @@ data_choice <- "facebook_x"

## Text analysis

Read the Excel files of facebook or x in R. We use an Excel file with X data as an example.
Read the Excel files of facebook or X in R. We use an Excel file with X data as an example.

```{r readxl}
# read the excel data from folder, using data from x for example
Expand All @@ -121,7 +121,7 @@ fsq_words <- fsq %>%
filter(nchar(token) > 3) # Remove words of max. 3 characters
```

... and have a quick look at the most frequently used words. We can already guess what this set of boeren of netherlands on social media x are about: frequently used words such as "people", "food", and "policy" "right" indicate different areas of concern present in social media posts. Note that we have 1609 rows, each representing one distinct word. This is the vocabulary we will provide as input to the word cloud.
... and have a quick look at the most frequently used words. We can see frequently used words such as "people", "food", and "policy" "right" indicating different areas of concern present in social media posts. Note that we have 1609 rows, each representing one distinct word. This is the vocabulary we will provide as input to the word cloud.

```{r tokens-rank}
# Count the token frequency
Expand All @@ -147,4 +147,10 @@ wordcloud(words = fsq_words_top100$token, freq = fsq_words_top100$n,

### Exercise: Visualising scraped data

You've been scraping data throughout the workshop. Now it is time to visualise it. Follow the steps from the web scraping tutorial to visualise the Facebook or X data you scraped during the workshop in a word cloud. What do you see? How would you describe the discourse of/about farming communities on social media?
You've been scraping data throughout the workshop. Now it is time to visualise it.

1. In the `Files` tab of RStudio, click on `Upload`. Navigate to the target directory `~/mint2324Q3U/data/facebook_x`, click on `Choose File` to select the Excel file with your scraped data and click on `OK`.

2. Follow the steps from the web scraping tutorial to visualise the social media data you scraped during the workshop in a word cloud.

What do you see? How would you describe the discourse of/about farming communities on social media?

0 comments on commit 73706ed

Please sign in to comment.