Browse Source

last minute changes

master
JayVii 7 months ago
parent
commit
6df5915926
2 changed files with 58 additions and 19 deletions
  1. 2
    2
      scripts/collecto.R
  2. 56
    17
      scripts/plotte.R

+ 2
- 2
scripts/collecto.R View File

@@ -106,7 +106,7 @@ tweets <- within(data = tweets, expr = {

# Exclusion------------------------------
# before 2019-01-01, after 2019-02-17, protected tweets
tweets <- tweets[(as.Date(tweets$date) > as.Date("2019-01-01") &
tweets <- tweets[(as.Date(tweets$date) > as.Date("2019-02-11") &
as.Date(tweets$date) < as.Date("2019-02-17")),]
tweets <- tweets[!tweets$protected,]

@@ -136,7 +136,7 @@ toots <- within(data = toots, expr = {

# Exclusion ----------------------------
# Only include Toots from this year
mst_exclude <- which(as.Date(toots$date) < as.Date("2019-01-01") |
mst_exclude <- which(as.Date(toots$date) < as.Date("2019-02-11") |
as.Date(toots$date) > as.Date("2019-02-17"))
if(length(mst_exclude) > 0){ toots <- toots[-mst_exclude,] }


+ 56
- 17
scripts/plotte.R View File

@@ -10,6 +10,8 @@
if(!require("ggplot2")){ install.packages("ggplot2"); library("ggplot2") }
if(!require("gridExtra")){ install.packages("gridExtra"); library("gridExtra") }
if(!require("wordcloud")){ install.packages("wordcloud"); library("wordcloud") }
if(!require("tm")){ install.packages("tm"); library("tm") }

# Text Manipulation --------------------
if(!require("stringi")){ install.packages("stringi"); library("stringi") }

@@ -19,13 +21,7 @@ if(!require("tidyr")){ install.packages("tidyr"); library("tidyr") }
# Loading Data -----------------------------------------------------------------

# Full Dataset -------------------------
load(file = "../data/ilovefs-all_2019-02-07_09-15-38.RData")

# Extracted "mentioned projects" -------
if(length(grep(x = list.files("../data/"), pattern = "tags_mentions.csv")) > 0){
hash_ment <- read.csv2(file = "../data/tags_mentions.csv", sep = ",",
header = FALSE)
}
load(file = "../data/ilovefs-all_2019-02-15_09-04-53.RData")

## Extract Mentions ------------------------------------------------------------

@@ -66,7 +62,7 @@ platform <- factor(c(twt_num, mst_num, rdt_num),
instances <- sub(x = toots$inst, pattern = "urn:X-dfrn:", replacement = "") %>%
sub(pattern = ":.*", replacement = "")
# Assign instances with "low" occurance the "other" tag
inst_other <- names(table(instances)[table(instances) < 4])
inst_other <- names(table(instances)[table(instances) < 3])
instances[instances %in% inst_other] <- "other"
instances <- as.factor(instances)

@@ -116,7 +112,7 @@ part1_plot <-
# Margins: top, right, bottom, left
plot.margin = unit(c(-0.5, -0.5, -0.5, -0.5),"in")) +
# Draw Title and Text inside Plot
annotate("text", x = 0, y = 0, fontface = 2, size = 8,
ggplot2::annotate("text", x = 0, y = 0, fontface = 2, size = 8,
label = "Participation in #iLoveFS\nper Platform") +
geom_text(aes(x = 3.5, y = pos, label = count), size = 6) +
labs(title="") +
@@ -126,7 +122,7 @@ part1_plot <-
" (", part1_df$count, ")"),
breaks = part1_df$category, values = part1_df$colors)

part2_plot <-
part2_plot <-
# Inital Plot, maximum values, etc
ggplot(part2_df, aes(fill = category, ymax = ymax, ymin = ymin, xmax = 4,
xmin = 3)) +
@@ -143,7 +139,7 @@ part1_plot <-
# Margins: top, right, bottom, left
plot.margin = unit(c(-1, -1, -1, -1),"in")) +
# Draw Title and Text inside PLot
annotate("text", x = 0, y = 0, fontface = 2, size = 8,
ggplot2::annotate("text", x = 0, y = 0, fontface = 2, size = 8,
label = "Participation in #iLoveFS\nin the Fediverse") +
geom_text(aes(x = 3.5, y = pos, label = count), size = 6) +
labs(title="") +
@@ -213,11 +209,54 @@ mentions <- c(
tolower()

# valid mentions -----------------------
ment_acc <- c("freesoftware", "ilovefs", "foscon", "fsfe", "debian", "linux",
"android", "gnu", "fdroid", "fsf", "fosdem", "publiccode",
"framasoft", "videolan", "opensrcdesign", "kdecommunity", "kde",
"libreoffice", "official_php", "mediawiki", "opensuse",
"centosproject", "gauteh", "free", "datalabx")
ment_acc <- c("mesa", "ilovefs", "fsf", "libreoffice", "fsfe", "godotengine",
"krita", "web3", "emacs", "bluehats", "debian", "eff", "nodejs",
"react", "linux", "typescript", "reactjs", "linkatedu", "bcn",
"kdeedu", "bcnfc", "bcnfs", "freebsd", "hardenedbsd", "rust",
"gnome", "qgis", "corine", "opendata", "gimp", "inkscape",
"fdroid", "fdroidapp", "vlc", "gnuhealth", "tumbleweed", "rstats",
"gnu", "firefox", "opensuse", "kde", "scribus", "tex", "compiz",
"openstep", "xfce", "xinelerra", "ffmpeg", "tor", "qubesos",
"siggraph", "audacity", "graphql", "beets", "publiccode",
"mastodon", "postgresql", "apache", "tomcat", "thunderbird",
"antennapod", "blender", "obs", "kdenlive", "cocos2dx", "vim",
"ubunturs", "flossbcn", "collaboraonline", "writer", "calc",
"impress", "drupal", "wordpress", "mozilla", "php", "mplayer",
"gramps", "ubuntu", "brew", "git", "grep", "bash", "kubuntu",
"kdeconnect", "cantata", "dolphin", "perl", "dolibarr",
"darktable", "librecmc", "openwrt", "handbrake", "mpa", "riot",
"diaspora", "linus", "linuxkernel", "davx5app", "osdiversity",
"opensrcdesign", "qtgeekes", "twidereproject", "web2write",
"xubuntu", "fdroidorg", "archlinux", "flatpakapps", "imagemagick",
"play0ad", "mastodonsocial", "gimp_official", "bcnfreesoftware",
"xfceofficial", "texmakereditor", "matplotlib", "gnuoctave",
"spyder_ide", "anacondainc", "atomeditor", "projectjupyter",
"blender_org", "framasoft", "zotero", "calibreforum",
"lineageandroid", "nextclouders", "signalapp", "linuxfoundation",
"transportr", "openstreetmap", "borgbackup", "thomasjwaldmann",
"freebsdfndation", "anked", "mozthunderbird", "ravada_vdi",
"arkoscloud", "yunohost", "kdecommunity", "riotchat", "redhat",
"torproject", "atomicmutton", "percona", "aberuni", "wikicommons",
"chakralinux", "getaudacity", "i3wm", "synthing", "orgmode_bot",
"fedora", "obsproject", "orgzly", "jellyfin", "wikipedia",
"openvpn", "wire", "goldendict", "zealdocs", "roundcube",
"openpowerorg", "collaboraoffice", "trakiatech", "jettyproject",
"glassfish", "netbeans", "videolan", "vcvrack", "keepassxc",
"linux_mint", "isard_vdi", "nagiosinc", "elastic", "mantisbt",
"ubports", "elementary", "llvmorg", "gnutools", "apacheoo",
"wikimediade", "wikidata", "mysql", "official_php", "mariadb_org",
"fsfe", "openproject", "adolflow", "datosgob", "oeg_upm",
"librelabucm", "av_floss", "languagetoolorg", "magit_emacs",
"docker", "apackemxnet", "rstudio", "nestsimulator", "qtproject",
"suse", "cpluspluscom", "neovim", "ubuntu_mate", "framapiaforg",
"openjdk", "lazarusdev", "koditv", "puri_sm", "arduino", "sabdfl",
"canonical", "opensense", "tails_live", "centosproject",
"ubuntu_os", "librezale", "openofficeorg", "fsfefrance",
"dotclear", "mastalab", "osmandapp", "stepmania",
"vlcmediaplayer", "openbsd", "webgatesrl", "ow2", "xwiki",
"spagobi", "uclsteapp", "namelesscoder", "gnupg", "android",
"opensourceorg", "mozillafirefox", "joindispora", "matrixdotorg",
"Mastodonproject")
mentions <- mentions[mentions %in% ment_acc]

# color assignment ---------------------
@@ -225,11 +264,11 @@ wcol <- rainbow(length(unique(mentions))) %>%
sub(pattern = "FF$", replacement = "99")

# Plot results -------------------------
set.seed(1337) # reproducability!
filename <- paste0("../plots/wordcloud_",
gsub(x = Sys.time(), pattern = "-.*", replacement = ""),
".pdf")
pdf(file = filename, height = 4, width = 4)
set.seed(404) # reproducability!
wordcloud(mentions, colors = wcol, min.freq = 1, rot.per = 0.25,
random.color = TRUE, random.order = TRUE)
dev.off()

Loading…
Cancel
Save