Hello again and thank you all so much for the help. Well, I tried and did it
myself, here's what I wrote:

library(tnet)
net <- read.table("data.txt")
net <- as.tnet(net, type="longitudinal tnet")

loop <- range(net[,1])
net.static <- vector(length=as.integer(loop[2]-loop[1])+1, mode="list")
j <- 1
while(loop[1] < loop[2]) {
        net.static[[j]] <- as.static.tnet(net[net[,"t"]<=loop[1],])
        degree <- degree_w(net.static[[j]])
        results[[j]] <- apply(degree, 2, mean)
        print(results[[j]])
        loop[1] <- loop[1]+(30*30*24)
        j <- j+1
}
max(loop[2]-loop[1])

and... it actually works, BUT
for every screenshot, it doesn't give the mean once, it prints it as many
times as the raws of the screenshot!
So if one screenshot has 3 lines, I get the result three times and then the
following screenshot's result as many times as the raws it has! Trying to
figure out why! Can somebody please help me?

By the way, I did tried this:

get_network_slices<-function(timestamps) {
 nslices<-length(timestamps)
 netslices<-list()
 for(slice in 1:nslices) {
 this_slice<- as.static.tnet(net[net[,"t"]<=as.POSIXlt(timestamps[slice],])
 degree_w(this_slice)
 netslices[[slice]]<-list(degree_w,apply(this_slice,2,mean))
 }
 return(netslices)
}

and got an error that this_slice is not defined!!!


--
View this message in context: 
http://r.789695.n4.nabble.com/Loop-Help-tp4633558p4633617.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to