# NOT RUN {
data(freeassociationdata)
# It is a time consuming function...
# }
# NOT RUN {
wordvars = c("diet1stword", "diet2ndword", "diet3rdword")
df.with.centralities1 = add.centrality.variables.to.data.frame(wordvars,
"centrality_eigen", freeassociationdata)
# Variables with the centralities of the words in wordvars was added
# in the end of df.with.centralities1.
# Histogram of eigen centrality index
hist(df.with.centralities1$diet1stword_centrality_eigen)
# One may ask for two centralities...
df.with.centralities2 = add.centrality.variables.to.data.frame(wordvars,
c("centrality_authority", "centrality_betweenness"), freeassociationdata)
# Pearson correlation between authority and betweeness centrality indexes for the 1st word
# concerning diet.
cor(df.with.centralities2[c("diet1stword_centrality_authority",
"diet1stword_centrality_betweenness")], use="complete.obs", method = "pearson")
# ...or even all available centralities.
# Warning: depending on the number of variables and the size of the data frame, it may be a
# time consuming procedure...
df.with.centralities2 = add.centrality.variables.to.data.frame(wordvars,
"all", freeassociationdata)
# }
Run the code above in your browser using DataLab