For my thesis I am currently trying to make tradelinks, but with the last lines to make a new csv document i get an error:
Error in i_set_vertex_attr(x, attr(value, "name"), index = value, value = attr(value, :
Length of new attribute value must be 1 or 207, the number of target vertices, not 1934.
I am a complete beginner, but I am using two csv files as imports. 1 shows country codes and trade value over a period of 11 years and the other shows country codes and country names.
But I also found out that only at the closing bracket, where it says 'unexpected' does it give the error. Does this mean that is should be able to find the csv document somewhere?
I suggest you go back to your code that was supposed to make d1, because that is what hasn't worked.
Here you can read about reprex in general. but it seems you need to take more time to identify your first point of failure. always tackle errors from the top down and not from the bottom up. goodluck !
I have found my first problem, it is with this code:
V(g)$pop<-links[,c(2+endper+period)]
I get the following error:
Error in i_set_vertex_attr(x, attr(value, "name"), index = value, value = attr(value, :
Length of new attribute value must be 1 or 44, the number of target vertices, not 1770
Do you know how to resolve this?
links is a csv file with 1770 obs. and 41 variables
endper is 12
period is 1
i do not know what c is, could this be the issue?
c is a function for concatenating items in R, but its also not needed in this operation, and its also not the cause of any problem.
You are basically here taking the 15th column of links (2+12+1 = 15 ) and trying to put the 1770 facts/information there into some attached pop name to the vertex list of your graph.
The error messsage implies there are only 44 locations in V(g)$pop, so stuffing 1770 different facts into 44 piegeon holes isnt going to work ...