Open brieaspasia opened 4 years ago
Your NetMatrixM object from bibliometrix is a dgCMatrix (you can see by running class(NetMatrixM)) . You can read more about this object class here: https://www.r-bloggers.com/what-is-a-dgcmatrix-object-made-of-sparse-matrix-format-in-r/ You can convert it to a simple matrix: NetMatrixM2 <- as.matrix(NetMatrixM) Then to a wide-format data frame: NetMatrixM3 <- as.data.frame(NetMatrixM2) NetMatrixM3$Country <- rownames(NetMatrixM3) #add a column with countries names from the rownames Then you can reshape it into a log format data frame: library(tidyverse) out <- gather(NetMatrixM3, key = COL_NAME, value = Linkscount, -Country) This contains counts of links, which you may want to recalculate into frequencies, if needed.
I extracted clusters from the networkPlot output. I still need to figure out how to map this to groups like the example shown below and linked in the main text.
I'm not sure what else I need to do to transform my data into something that would work with the example at https://www.data-to-viz.com/graph/chord.html
it looks like there are two ways: https://www.r-graph-gallery.com/123-circular-plot-circlize-package-2.html
Do I need to remove cross matches, for example if one row is from$A - to$B, then the next row is from$B - to$A? I'm not sure how the network assigns these matches, but I would assume that this is a duplicate?
Do I need to remove cross matches, for example if one row is from$A - to$B, then the next row is from$B - to$A? I'm not sure how the network assigns these matches, but I would assume that this is a duplicate?
@brieaspasia I am not sure what you are talking about - could you please give line numbers or a code fragment?
Do I need to remove cross matches, for example if one row is from$A - to$B, then the next row is from$B - to$A? I'm not sure how the network assigns these matches, but I would assume that this is a duplicate?
@brieaspasia I am not sure what you are talking about - could you please give line numbers or a code fragment?
@mlagisz referencing 'out2' at line 65-66, I've pasted an example just below. Are the 1st/2nd line and the 3rd/4th line duplicates? And how to I remove them? This example was using the 2015-2017 subset rather than the full data.
@brieaspasia I think all counts are appearing twice, likely because the connections were calculated both ways independently, i.a. a to B and B to A. The code below should work for removing duplicates:
str(out2)
DT <- mutate(out2, out2mult = as.numeric(as.factor(out2$University)) * as.numeric(as.factor(out2$COL_NAME))) str(DT) duplicated2(DT, by=c("out2mult", "Linkscount")) DT_distinct <- distinct_at(tibble(DT), vars("out2mult", "Linkscount"), .keep_all=TRUE)
DT_distinct <- DT_distinct[(DT_distinct$University!=DT_distinct$COL_NAME),] #remove self-links for better visibility str(DT_distinct) View(DT_distinct)
I've successfully made network maps of the affiliations, called 'collab_graph' in figures folder. I'd still like to solve the chord diagram in order to understand how to make it, I'm very close! Lines 86-103 of 'mp-affiliations' I've created a chord diagram, I just need to order and graph by groups and to fix the labels (using circos.text, but I couldn't quite solve it). This is where I'm at right now:
If you are using the ggplot system - you can change the "angle"
@brieaspasia - great to see you got this working. It is worth comparing this with the "classical" network graph with automatic clustering to see if there are any clusters visible there. Also, if you use countries instead of affiliations - is there any clustering? (it may look better on chord diagram, since there will be fewer nodes)
Using Chord Diagram to map collaborations between affiliations in the biblioAnalysis results file
[ ] Group by geographic cluster, as in figure 15.10-15.12 I created a df of the networkPlot clusters at line 40, joined it to the df at 68-69, and created names for the final labels at 113-123. I need to figure out how to incorporate this grouping into the diagram.
[ ] figure out circos.text function in order to create meaningful labels example
[ ] make sure I understand what the graphic is communicating - collaboration between educational institutions by those who collaborate most often internationally but not linked to those that produce the most research
[x] Create a value column between affiliations or aff_frac to visualise collaborating affiliations
Ex: