brieaspasia / mp-diagnostics

Initial analysis of marine pollution research
0 stars 0 forks source link

mp-affiliations #6

Open brieaspasia opened 4 years ago

brieaspasia commented 4 years ago

Using Chord Diagram to map collaborations between affiliations in the biblioAnalysis results file

Ex: Screen Shot 2020-07-14 at 2 04 55 PM

mlagisz commented 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.

brieaspasia commented 4 years ago

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. Screen Shot 2020-07-22 at 3 05 45 PM

brieaspasia commented 4 years ago

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

mlagisz commented 4 years ago

it looks like there are two ways: https://www.r-graph-gallery.com/123-circular-plot-circlize-package-2.html

brieaspasia commented 4 years ago

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?

mlagisz commented 4 years ago

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?

brieaspasia commented 4 years ago

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. Screen Shot 2020-07-23 at 11 25 18 AM

mlagisz commented 4 years ago

@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:

View(arrange(out2, desc(Linkscount)))

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)

brieaspasia commented 4 years ago

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: Screen Shot 2020-07-26 at 4 55 44 PM Screen Shot 2020-07-26 at 4 53 29 PM

itchyshin commented 4 years ago

If you are using the ggplot system - you can change the "angle"

mlagisz commented 4 years ago

@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)