I have some issue while adding properties of nodes in igraph working with R. I made a text list named journal.txt and I want to give the nodes of my graph a property. With other textual or numeric lists, I had absolutely no issues, but with this one I have.
with this I read the txt file, read just the first column, although there is just one, read as character, although i tried also without and it doesn’t work
journalList = read.csv("c:/temp/biblioCoupling/journals.txt", header=FALSE)
journalLR = (journalList[1:303,1])
journalLR = as.character(journalLR)
V(g)$journalName = journalLR
then when I save the file,
write.graph(gr,"filename.gml",format=c("gml"), creator="Claudio Biscaro")
I see all other properties I added to nodes, but not this one!!!
could it be because some entry in journalLR is more than 15 character long?
I have absolutely no idea why I can’t do that
Your code is not reproducible, it is impossible to tell for sure, but I guess that
V(g)$journalNameis a complex attribute, i.e. it is not a vector of values, but a list of values.To check, you can do
str(g)and then look at the code letter after thejournalNameattribute. If it isx, then it is complex, if it isc, then it is character.If this is the problem and you don’t really need a list, then the workaround is to do