mardi 2 mai 2017

Loop in creating random networks does and calculating network parameter does not work

I have a two-mode, undirected, unweighted network. One mode are people, the other are projects that they participated in. With the parameters in my existing network I would like to generate random networks (at least 1000) and calculate the same parameter for each of these networks. I need to write a loop, but it doesn´t work. The warning message is:

Error in if (NC == 2) net <- data.frame(tmp[, 1], tmp[, 2]) : argument is of length zero In addition: Warning message: In out5[i] <- projecting_tm(randonet5, "Newman") : number of items to replace is not a multiple of replacement length

That´s the code:

for 10 random networks-->I need 1000 later on

out5 <- c(1,2,3,4,5,6,7,8,9,10)

for(i in 1:length(out5)) {

randonet5 <- rg_tm(ni=133,np=48,ties=190,weights=1,seed=i)

out5[i] <- projecting_tm(randonet5, "Newman")

out6 <- betweenness_w(out5[i])[,"betweenness"]}

The original is from this website: http://ift.tt/2qAaesx

Can somebody tell me what I am doing wrong? Thank you so much!




Aucun commentaire:

Enregistrer un commentaire