[R] Loop Help

2012-06-16 Thread @ngel
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'

Re: [R] Loop Help

2012-06-16 Thread @ngel
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

Re: [R] Loop Help

2012-06-18 Thread @ngel
I think that for now I'll keep it as is and try to clean the data in excel. Could someone please tell me how can I export the result to csv, since write.csv exports only the last j? Thank you so much in advance! -- View this message in context: http://r.789695.n4.nabble.com/Loop-Help-tp4633558p46

Re: [R] Loop Help

2012-06-18 Thread @ngel
Hello Jim thank you so much for your response. When I use write.csv, on the csv file is saved only the last loop So when I write results.matrix <- apply(degree_w(net.static[[i]]), 2, mean) write.csv(results.matrix, file = "results.csv") instead of getting a 550 line document with all loop result

Re: [R] Loop Help

2012-06-18 Thread @ngel
Thank you Jeff, that sounds like the solution to my problem but how would I do that code-wise? could you please help? -- View this message in context: http://r.789695.n4.nabble.com/Loop-Help-tp4633558p4633701.html Sent from the R help mailing list archive at Nabble.com. _