#start with clean workspace
rm(list=ls())
getwd()
#> [1] "C:/Users/ninab/OneDrive/Documenten/GitHub/labjournal"
packages
library(data.table)
library(tidyverse)
require(stringi)
require(RSiena)
load data
getwd()
#> [1] "C:/Users/ninab/OneDrive/Documenten/GitHub/labjournal"
load("./data/names_df2_v20220106.RData")
load("./data/names_df_publications_v20221006.RData")
selecting only the
staff members from RU sociology
#wrong gs_id (just by eye-balling)
deselect <- c(24,25,34,35)
#selecting only the names of RU sociology staff members
names_df %>%
filter(affiliation=="Radboud University") %>%
filter(field=="sociology") %>%
filter(!(id %in% deselect)) -> soc_df
# Selecting only the publications of RU sociology staff members
names_df_publications %>%
filter(gs_id %in% soc_df$gs_id) -> socpub_df
#attaching the gs id and lasname of staff member to their publications in socpub_df
soc_df %>%
select(c("gs_id", "lastname")) %>%
right_join(socpub_df) -> socpub_df
cleaning names
soc_df$lastname_pubs <- as.character(str_split(soc_df$lastname, pattern=",", n = 2, simplify = TRUE)[,1])
socpub_df$author <- tolower(socpub_df$author)
adding ethnicity
Ethnicity of the ego was conducted by hand, by looking at the last
name of the ego and their appearance. Everyone with a Dutch name got the
score “1” and everyone with a Dutch name got the score “0”. The ethnic
diversity of the egonet was caculated by looking at the collaborators of
the papers in the period 2019-2022. Ethnicity of the alters was also
decided by looking at the last name and appearance of the unique
collaborators. Ethnicity of the egonet is operationalized as the
percentage of people within the network with a non-Dutch name. —-
#select the publication of these staff members you want
socpub_df %>% filter(year>2019) %>%
select(c("author", "gs_id")) -> soc_pubs_etni
#adding collaborators ego to the soc_df dataframe
gs_id <- soc_pubs_etni$gs_id
soc_pubs_etni <- stats::aggregate(x=soc_pubs_etni$author, by=list(gs_id), FUN=toString, na.rm=TRUE)
names(soc_pubs_etni) <- c("gs_id", "author")
soc_df <- left_join(soc_df, soc_pubs_etni)
author2 <- list()
for (i in 1: nrow(soc_df)) {
author2[[i]] <- unique(unlist(str_split(soc_df$author[i], ",") ))
author2[[i]] <- sub(author2[[i]], pattern="([A-Z]+ )", replacement=" ")
author2[[i]] <- sub(author2[[i]], pattern="([A-Z]\\.)", replacement=" ")
author2[[i]] <- trimws(author2[[i]])
author2[[i]] <- unique(author2[[i]])
}
#loading excel file with data with the information of diversity of the egonet, constructed by hand
div <- read.csv2("./data/div_RU.csv")
In this excel file: nauthors = number of alters in the egonetwork.
Nnl = number of alters with a non-Dutch name. Div = ethnic diversity of
egonet in percentage. Div.ego = diversity of the ego, with 1 is Dutch
and 0 is non-Dutch
#adding ethnicity to soc_df
soc_df <- cbind(soc_df, div)
soc_df$div.net <- as.numeric(soc_df$div)
save(soc_df, file="./data/descriptives/RU_dfv1.RData")
save(socpub_df, file="./data/descriptives/RUpub_dfv1.RData")
adding age
Age of the ego is
operationalized as the year of their first publication.
#year first pub
socpub_df %>% group_by(gs_id) %>%
mutate(pub_first = min(year, na.rm=TRUE)) %>%
select(c("gs_id", "pub_first")) %>%
distinct(gs_id, pub_first, .keep_all = TRUE) -> firstpub_df
soc_df <- cbind(soc_df, firstpub_df)
making gender
numeric
soc_df$gender3 <- recode(soc_df$gender, "female" = "0", "male" = "1")
soc_df$gender4 <- as.numeric(soc_df$gender3)
deleting scholars with
missing value on dependent variable -> Renea Loh
soc_df <- soc_df[!(is.na(soc_df$div.net)), ]
save(soc_df, file="./data/descriptives/RU_dfv2.RData")
save(socpub_df, file="./data/descriptives/RUpub_dfv2.RData")
LS0tDQp0aXRsZTogIlJVIGNvbnN0cnVjdGluZyBldGhuaWNpdHkgYW5kIGFnZSINCmF1dGhvcjogImJ5OiBOaW5hIEJyYW50ZW4iDQpiaWJsaW9ncmFwaHk6IHJlZmVyZW5jZXMuYmliDQotLS0NCg0KDQoNCmBgYHtyLCBpbnN0YWxsIHJlbW90ZWx5LCBnbG9iYWxzZXR0aW5ncywgZWNobz1GQUxTRSwgd2FybmluZz1GQUxTRSwgcmVzdWx0cz0naGlkZScsIGV2YWw9RkFMU0V9DQppbnN0YWxsLnBhY2thZ2VzKCJyZW1vdGVzIikNCnJlbW90Z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