Hello all, I'm new here and new to R, but I have to admit I'm learning rather fast. Right now I need to write a loop, and I don't seem to think I'm doing it properly, judging by the errors I get! What I need to do is to insert my data (csv-table) into a variable, and take snapshots of my data (it's longtitudinal) and they 'play' with the snapshot. To give you an example:
# I Load tnet the library I need library(tnet) # I Load my data net <- read.table("data.txt") # Check if net is tnet net <- as.tnet(net, type="longitudinal tnet") # And slice the data getting new variables for every day net.101031 <- as.static.tnet(net[net[,"t"]<=as.POSIXlt("2010-10-31 00:00:00"),]) # Then get the degree of the sliced network degree_w(net.101031) # and the mean of each column in the data.frame apply(net.101031, 2, mean) Now the problem is that there are way too many "days" to do it manually and I need to wrap this part: net.101031 <- as.static.tnet(net[net[,"t"]<=as.POSIXlt("2010-10-31 00:00:00"),]) degree_w(net.101031) apply(net.101031, 2, mean) in a loop, and print the results. But... Can someone please help me...???? Thank you so much in advance! -- View this message in context: http://r.789695.n4.nabble.com/Loop-Help-tp4633558.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.