Conferencing as a ‘Grown-up’

I’m jet-lagged as hell after getting back from Vienna, Austria last night so thought I would write a wee blog, because what could possibly go wrong!? (The fact that I immediately found two glaring spelling errors in the above sentence is a good indicator that something will indeed go wrong).

The European Geosciences Union General Meeting (the EGU) takes place in Vienna, Austria, for a week every April and brings together geoscientists from around the world. It’s the biggest geoscience conference in Europe, and the second biggest in the world (after the AGU which I wrote about here) – 15,075 scientists from 106 countries attended, to give you an idea of the scale! It turned out to be a very social conference for me, since a fair few of my friends and colleagues from WA and around the world also attended, so there was plenty of opportunity for drinking beer networking throughout the week. It was really great to be able to see my friends present their work, since we don’t usually talk shop that often – it turns out that the people I know are bloody clever!

20180412_183843.jpg
Pleasantly surprised to find that some buddies I met in Dresden in 2016 were attending!

This is the last conference I’ll get to attend during my PhD, and is the first conference where I’ve felt moderately comfortable in my work – hence the idea of conferencing as an adult. Throughout the week I had the satisfaction of seeing my methods validated in other people’s work, and after a couple of pep talks from some PhD buddies, worked up the courage to approach a couple of people about jobs. Even though my poster session was Friday evening (you can check out my poster here if you’d like), attendance in the session was still high, and the feedback I received was generally good. It may have helped that I unashamedly bribed passers-by with snacks, which turned out to be an effective tool to get people to stop! After so long working on the same thing I find that I’ve lost sight of how bloody cool my work is (biased opinion, but true nonetheless!), so seeing people’s excited reaction to the length and resolution of the proxy records, as well as the results, was a good reminder! I’m really excited to get a paper submitted about the work, and discussions over beers also opened up a couple of possible future collaborations, so we’ll see where that goes.

Side note: the whole paragraph above is terribly positive, and it’s really messing with my usual reflex of self deprecation. I’m trying something new.

20180413_084148.jpg
All ready for the last session of the week, which my favourite barista described as ‘headlining the conference’ – I’ll take it.

A highlight of the conference was the many short courses that ran during the week – I particularly enjoyed the short course about combating fake news in science (the theme of the 21st Century?). I linked a few of the takeaways on Twitter, which you can take a look at by clicking on the tweet below.

All in all, I had a wonderful conference (and a great mini-holiday checking out some sights the week before), and I’m feeling ready and inspired to finish this PhD and move onto something new! Check out some gratuitous snaps below from a fortnight in Vienna, Budapest, Bratislava and Salzburg.

Advertisements

Plotting made easy with the power of functions.

What do you do when you have a million variables to plot (separately), and need to speed the process up a bit? Write a function to do your plots for you!

After 4-ish years of steady work in #rstats, I had a (minor) break-through last week. Instead of editing scripts for each plot (time-consuming, and confusing), why not write a function to produce the plots? Seems obvious, and I’m embarrassed that it took me so long to think of it.

So here we go.

 #your dataset
Time<- seq(1:10)
A <- rnorm(10, mean=15, sd=3)
B <- rnorm(10, mean=15, sd=3)
C <- rnorm(10, mean=15, sd=3)
D <- rnorm(10, mean=15, sd=3)
E <- rnorm(10, mean=15, sd=3)
F <- rnorm(10, mean=15, sd=3)
G <- rnorm(10, mean=15, sd=3)
H <- rnorm(10, mean=15, sd=3)
plotf <- function(Time,variable) {
df <- data.frame(Time,variable) #make variables into a data frame
library(ggplot2) #ggplot for life!
# we'll use this to label the y-axis independently
y_name <- deparse(substitute(variable))
ggplot(data=df,aes(x=Time)) +
geom_line(aes(y=variable)) +
labs(x="Time", y= y_name)+
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.title = element_text(size=20),
axis.text = element_text(size=16),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
panel.border = element_rect(colour = "black", fill=NA)) #all of this is just to make the graph look nice
}
#produce your plot!
plotf(Time, B) 
rplot
Et voila! Make 10 identical plots in ~2 minutes. 

Maybe I’m a Scientist?

I’ve made no secret about how hard I’ve found PhD life (see here, if you want to feel a bit sad, but maybe also happy?), and the decline in post frequency here (in what was already a blog of infrequent posts) probably reflects the general feelings of disconnect I have about academia. At this stage in my ‘academic journey’ – i.e. facing the gunbarrel of thesis completion, and the end of my stipend, and unemployment, and etc. etc. – I am very much in ‘head down, get it done, get out of academia’ mode.

Anyway, all of that to say that I don’t often feel like a scientist. This is likely rooted in the ivory tower idea that if you’re not in academia you’re not really doing science, and I’m pretty dead set on leaving (at least for a while). Of course, I know this is bullshit, and if any of my scientist friends outside of academia told me they weren’t scientists I would be bathing in the blood of whoever gave them that idea telling them very earnestly, with itemised examples, that they are indeed scientists.

But today. Today, I’m a scientist. Why is that? I got my first ever peer-reviewed journal article published. It took many rounds of review, some tears, alcohol, and a small tantrum, but now it’s out there for the world to see (and judge, which is a whole ‘nother fear). And I’m a scientist!

You can check it out here, (or drop me an email and I’ll send you a pdf).

20171123_185946.jpg
Unrelated photo, but Summer has finally returned to Perth and life is beautiful!

 

A Tale of Two Conferences

In the last few months I have been lucky enough to attend a couple of international conferences. Perth is a long way from anywhere, so being able to get out of town and meet some scientists is pretty bloody fantastic!

In December I went to the American Geophysical Union Fall Meeting (along with half of UWA, or so it seemed). Anybody in earth sciences knows that the AGU is the big kahuna of conferences. This year 23 000 people attended, and there were talks on everything from the weather on Mars to river hydraulics. It’s awesome. It’s also very, very overwhelming. Just getting there involved 3 flights (PER-SYD-LAX-SFO) and took something like 30 hours.  Needless to say I was in peak form when I stumbled into my accommodation on the Sunday afternoon. The second thing that nobody tells you is that you can’t see everything. There is no physical way you can attend every talk you’re interested in, see every poster, shake every hand. It’s just too big. Letting go of this attendees guilt is also tricky. Choosing between a palaeo-climate talk and a groundwater hydrology talk is impossible, and sometimes you just have to sneak away and go and learn something about Mars because if someone brings up the Navier-Stokes Equation one more time you might just kill yourself. Or them.

15440534_10154837663946214_3922783751556327416_o

Gleefully science-ing with the world’s biggest poster

While I felt that my poster session went well (people actually stopped and talked to me, and seemed somewhat interested), I felt disappointed with the conference as a whole. It’s not that it’s not great (it is so, so great), but at this stage in my career (i.e. as a nobody), it’s hard to escape the feeling that the people that you want to meet, aren’t there to meet you.

For a lot of academics, the AGU is the best opportunity to catch up with international colleagues and scheme. This is understandable, but without an avenue to get into this scheming it is easy to feel like the hard work in getting there and presenting isn’t worth it.

Nonetheless, the AGU is brilliant. I highly recommend going if you have established connections who are also going! As a lowly PhD candidate who knows no-one, I’m not convinced it was worth it.

Bonus picture of Half Dome in Yosemite, because if you think I was going to go to California without going to Yosemite you’re nuts.

Last week (early February) I went to New Zealand to attend the 17th Biennial Australian and New Zealand Geomorphology Group meeting. This experience couldn’t have been more different. Just 80 attendess, ‘trapped’ in a tiny town (Greytown, north of Wellington in the Wairarapa) for a week. It was awesome. Also, I am moving to NZ. It’s like Australia but better.

Over the week I think I spoke to every single attendee. I saw every talk, because there were no concurrent sessions. By the end of the week I felt like I had not only made some good contacts, but I had met people who I could see myself becoming friends with. It was such a stark contrast to the (admittedly fun) chaos of the AGU.

So I guess my half-baked advice to PhD Candidates out there, who have limited funds to get to conferences is not to discount the smaller conferences. Talking to 80 people at a smaller conference has got to be more beneficial than talking to 20 people at a giant conference. Saying that, if you have money to burn, go to the big conferences. Variety is the spice of life, and something like the AGU is spicy as hell!

Field trip to the entrance to the Dimworld  the Putangirua Pinnacles. 

Just Another Statistic

Over the weekend I had a bit of self realisation that may or may not surprise anyone in academia – I’m a bit depressed. In retrospect, this is not a surprise. Forgetting about research that has show that many PhD Students experience depression during their candidature, I feel like I should have realised that something was up heaps sooner.

Glaringly obvious signs that I should have noticed:

1. Massive decrease in my work ethic

LOVE science. I have loved science my whole life. Whether it was dinosaurs and ancient civilisations (thanks Jurassic Park and Indiana Jones), highschool biology (shout out to my highschool biol teacher, on whom I had a bit of a crush, and who was the most enthusiastic teacher I ever had), or later climate science, geomorphology, and hydrology, I have had a lifelong love affair with science. So when I look back at all the days this year when I have hated the thought of opening my laptop, when I have devoted hours to agonising over work, I probably should have realised that something was a bit off.

2. Loss of empathy (?)

I’m not sure empathy is the right word. But I’m missing something in my personal life at the moment. I’m normally pretty happy. I have good friends, who I love, and a great family, who I adore. It’s hard to describe, but I’m missing the ‘caring.’ I haven’t seen my parents in over a year (we live ~4000 kms away, but this is still unusual). I don’t even particularly want to see them, but I don’t not want to see them either. I just haven’t seen them. I also wrote a blog (unpublished – I don’t think I’ll ever publish it) about how I was just going through the motions with my friends. I didn’t even realise I wasn’t OK then. I was starting to think I was a sociopath, but thankfully it doesn’t look like that’s the case!

 

Anyway, I realised on Friday night (on the train of all places), when I was talking with my besty. She is obviously more in the know than me, since her reaction was pretty much ‘yeah.’ Since then I’ve been doing a lot of thinking.

This thinking started very bizarrely with depression impostor syndrome. Which took the shape of not feeling depressed ‘enough’ to bother doing anything about it. I.e. because I’m not suicidal or self-harming, I’m not depressed enough to worry about and I should just get over it. Fuck you sub-conscious. Luckily, I think I’m over this, and pretty keen to feel better.

I had a really good discussion with a friend who’s a clinical psych researcher about links between cognition and emotions which I think will give me some tools to recognise and change some of my behaviours and mindset. I’ve definitely noticed that just being aware of the problem has made me feel better, and has made me able to recognise when I’m paralysed and find some task to do to unfreeze me. At this point just realising that I’m not 100% seems to have helped a heap.

I also told my supervisor. What a fun discussion. Thankfully, my supervisor is a bit of a hero, he’s extremely supportive, and we discussed me maybe taking some time off next year if things don’t improve.

I guess I’m putting this out there as just another piece of the puzzle in academic mental health. While I’m not bringing up my mental health in daily conversation, I’m not ashamed of not being OK either. I’m also publishing it as a bit of an explanation/apology to friends and family – I’m sorry that I haven’t been able to be as good a friend as I would like to be lately.

Merging Social Networks in R

Shameless self promotion: the final results of this exercise have now been published (open access) here. Supplementary material includes updated scripts. 

At the moment I am interested not just how people are interacting within different co-authorship networks but how knowledge is shared between co-authorship networks. So I’m trying to figure out how to merge the different networks I’ve developed into one big, comprehensive, co-authorship network. The key to this being successful will be in retaining some identification of the original network (I think they will probably be colour coded) and the authors that collaborate across co-authorship networks will have their own colour. I haven’t figured this bit out just yet…

However, I have managed to merge the networks! And while I haven’t done it the easiest (i.e. combine the .bib files and run the network script from scratch) I think my way will be the most useful for keeping distinct sub-network attributes.

The first step was to draw up a dummy network. My co-authorship networks have thousands of unique authors, it’s much simpler to work with dummy data when working out the kinks (and then hopefully it will translate to the full data-set…).

network

I then wrote these simple ‘publications’ up as .bib files called ‘pink.bib’, ‘blue.bib’ and ‘orange.bib’. Original. I won’t include them all here but pink.bib looks like this:

@article{Paper1,
author = {Allen, A. and Baker, B. and Cook, C.},
journal = {Fictional Journal},
number = {14},
pages = {14--17},
title = {Paper 1},
volume = {29},
year = {2002}
}

@article{Paper4,
author = {Cook, C. and Ferrer, F.},
journal = {Fictional Journal 2},
number = {14},
pages = {14--17},
title = {Paper 4},
volume = {29},
year = {2003}
}

You get the idea.

Next I plotted all three networks separately using similar code to that detailed in this post.  However, I exported the co-author tables  (called dat, see below) so I didn’t have to continually re-run the network script. You can do this using write.table().

write.table(coauth.table, file = "pink.txt")

 

Once I had all three co-author tables for my three dummy networks (dat, dat2, and dat3) I called them into a fresh R console. I assigned them different vertex attributes (i.e. different colours) and finally merged them.

See the script below!

library(intergraph)
library(network)
library(igraph)

setwd("C:/Users/me/networks")

##FOR PINK FILES
dat<- read.table("pink.txt")
#you can check the class (format) of the data using the command:
class(dat)
#dat is a data frame, need to change it to a matrix to work with igraph
dat <- as.matrix(dat)
class(dat)
#here is where we create the adjacency network. Same step as in previous CNA post.
auth.graph <- graph.adjacency(dat, mode='undirected', weighted=TRUE)
auth.graph

#To set all vertices in this network to display as green - this will hopefully come into play when I finalise the joined network
dd <- set.vertex.attribute(auth.graph, "color", value = "green")

plot(dd, vertex.label.cex=0.8, edge.width = E(dd)$weight)

This gives us the green sub-network.
green


##FOR BLUE FILES
dat2 <- read.table("blue.txt")
dat2 <- as.matrix(dat2)
auth.graph2<- graph.adjacency(dat2, mode='undirected', weighted=TRUE)
auth.graph2
ee <- set.vertex.attribute(auth.graph2, "color", value = "blue")
plot(ee, vertex.label.cex=0.8, edge.width = E(ee)$weight)

blue


##FOR ORANGE FILES
dat3 <- read.table("orange.txt")
dat3 <- as.matrix(dat3)
auth.graph3<- graph.adjacency(dat3, mode='undirected', weighted=TRUE)
auth.graph3
ff <- set.vertex.attribute(auth.graph3, "color", value = "orange")
plot(ff, vertex.label.cex=0.8, edge.width = E(ff)$weight)

orange
Now for the final step – joining the sub-networks into one large co-authorship network. I still need to figure out how to retain the attribute information (colours) for each sub-network, but for now I’m content that I’ve got the bulk of the work done.


##JOIN NETWORKS
##Loses attributes
gg <- graph.union(dd, ee, ff)
plot(gg)

all
Hopefully I’ll get the last of the scripting done this week (forever overly-optimistic about how long it takes me!) and can show you the final product soon. Any suggestions are very welcome.

 

Co-authorship Network Analysis (CNA) in R

Update: Shameless self-promotion, but the final results of this exercise have been published in the International Journal of Speleology (open access) here – supplementary material includes updated scripts to run the analysis. 

I’m planning to do some meta analysis of co-authorship in my field, which is really cool, but there is one small problem: I have no experience in co-authorship analysis, or any kind of complex network analysis! Luckily, I’ve got some pretty excellent Google-fu, and I found a heap of blogs and other sources (posted at the bottom) to work with.

I plan to pull bibliographic data from Google Scholar or Web of Science, so this code uses bibtex files as the data source. First I made a dummy .bib file of ‘co-authors’ from the seven Harry Potter books. HP uber fans, please forgive any overt errors. The files were based on the first few characters from each book that I could think of, and now that I look at my final network I’m tempted to go back and do it properly. I named this file HP.bib and put it in my directory.


@article{One,
author = {Harry and Ron and Hermione and Malfoy and Hagrid},
title = {{Get that Stone!}},
journal = {The World of JKR},
year = {1996}
}
@article{Two,
author = {Harry and Ron and Hermione and Fred and George and Neville and Myrtle},
title = {{Big Snakes are Scary!}},
journal = {The World of JKR},
year = {1998}
}
@article{Three,
author = {Harry and Ron and Hermione and Sirius and Lupin and Malfoy and Wormtail},
title = {{Big Dog! I'm Going to Diel}},
journal = {The World of JKR},
year = {1999}
}
@article{Four,
author = {Harry and Ron and Hermione and and and Malfoy and Wormtail and Tonks and Voldemort and Cedric and Cho and Dumbledore},
title = {{Kill the Spare}},
journal = {The World of JKR},
year = {2000}
}
@article{Five,
author = {Harry and Ron and Hermione and Sirius and Lupin and Molly and Dumbledore and Bellatrix and Voldemort and Lucius},
title = {{It's a Trap}},
journal = {The World of JKR},
year = {1999}
}
@article{Six,
author = {Harry and Ron and Hermione and Dumbledore and Snape and Slughorn and Voldemort},
title = {{Harry gets an A}},
journal = {The World of JKR},
year = {2001}
}
@article{Seven,
author = {Harry and Ron and Hermione and Fred and George and Hagrid and Voldemort and Lucius and Malfoy and Lupin and Tonks},
title = {{Harry Dies}},
journal = {The World of JKR},
year = {2003}
}

The script for R is below. I tried to annotate the script as I went, but my Google powers exceed my #rstats skills, so there are cases when I’m not exactly sure why something works, just that it does work.


setwd("C:/Users/me")

#you may need to add the igraph, bibtex, and ggplot2 packages to R

library(bibtex)
library(igraph)

#read the .bib file in

citations <- read.bib("C:/Users/me/HP.bib")
#gives list of all citations and authors
authors <- lapply(citations, function(x) x$author)
#gives list of unique authors
unique.authors <- unique((unlist(authors))[grepl('family', names(unlist(authors)))])

#take a look!
unique.authors

#sets up the co-author adjacency matrix

coauth.table <- matrix(nrow=length(unique.authors),
ncol = length(unique.authors),
dimnames = list(unique.authors, unique.authors), 0)

#for loop that fills the adjacency matrix. Adds 1 to the matrix each time co-authors work together

for(i in 1:length(citations)){
paper.auth 0]
diag(coauth.table) <- 0

#inspect table
coauth.table

#remove ('and') from coauthor table. I used 'and' to separate the authors in the .bib file, and while 'and' wasn't listed in the author list, it was populated in the matrix table. Don't know why, but this fixed it.
coauth.table <- coauth.table[-13,-13]

#somehow this fixed the problem of double links when voldemort and tonks, and tonks and voldemort co-authored
auth.graph <- graph.adjacency(coauth.table, mode='undirected', weighted=TRUE)
plot(auth.graph, vertex.label.cex=0.8, edge.width = E(auth.graph)$weight)

#gets edge list from the adjacency graph.

edge <- get.edgelist(auth.graph)

#re-loading edgelist
igraph <- graph.data.frame(edge, directed=FALSE)

#Tcl/Tk Network Graph
tkplot(igraph, layout=layout.fruchterman.reingold)

#to make the co-authorship network less quantitative and a bit more qualitative, you can get numbers out of the CNA!

#Calculating centrality measures (dgree, betweeness, closeness, eigenvector centrality, coreness)
metrics <- data.frame(
deg=degree(igraph),
bet=betweenness(igraph),
clo=closeness(igraph),
eig=evcent(igraph)$vector,
cor=graph.coreness(igraph)
)
#print metrics
metrics

#visualising metrics. I like ggplot, but any old plotting in R is fine. It just won't look so nice!
library(ggplot2)
ggplot(
metrics,
aes(x=bet, y=eig,
label=rownames(metrics)) #,
#colour=res, size=abs(res))
)+
xlab("Betweeness Centrality")+
ylab("Eigenvector Centrality")+
geom_text()+
ggtitle("Key Players in Harry Potter";)

And this is the network that you get. It's definitely not the prettiest, but I couldn't be bothered screwing around with aesthetics for a dummy run, I'm just pleased that it works!

HP_5

And now, to all the people who’s code I unashamedly stole: thanks for hosting your scripts online! This is also why I blog my forays into coding, even though I’m not great – I’ve learned so much from other people’s code, it seems only fair to put it back out there.

References