Re: [R] Loop Help

2016-02-29 Thread David Winsemius
> On Feb 29, 2016, at 6:24 AM, Fernando McRayearth wrote: > > Need to create ascii maps for 10 species by writing a loop. So i have to have > the vectors ready in the Global Environment, and the "raster map" so the > information can be added. > > when writing the loop I am using the "paste"

[R] Loop Help

2016-02-29 Thread Fernando McRayearth
Need to create ascii maps for 10 species by writing a loop. So i have to have the vectors ready in the Global Environment, and the "raster map" so the information can be added. when writing the loop I am using the "paste" function because the only thing that changes in the vector is the name o

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. _

Re: [R] Loop Help

2012-06-18 Thread Özgür Asar
@angel, You can try append option in write.table for e.g. for(i in 1:20) write.table(i,"out.txt",append=T,sep="\t",row.names=F,col.names=F) This will help you save your all results by writing each results on subsequent rows. Hope this helps Ozgur >Hello Jim >thank you so much for your respons

Re: [R] Loop Help

2012-06-18 Thread David Winsemius
On Jun 18, 2012, at 5:47 AM, @ngel wrote: I think that for now I'll keep it There is no "it" in this message. Users of Nabble often fail to read the POsitng Guide where it is requested that you include context. as is and try to clean the data in excel. Could someone please tell me how c

Re: [R] Loop Help

2012-06-18 Thread Jeff Newmiller
Then don't do that. write.csv is designed to write a complete matrix or data frame in one call. Combine your list of matrices into one (e.g. using sapply) and write that in one call afterward rather than piecewise as you do the calculations. -

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 jim holtman
What do you mean by "only the last j"? write.csv writes to a file you specify and I assume that you are changing the file name if you are making successive writes. You need to provide more detail. On Mon, Jun 18, 2012 at 5:47 AM, @ngel wrote: > I think that for now I'll keep it as is and try to

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-17 Thread Jim Lemon
On 06/17/2012 08:50 AM, @ngel wrote: 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

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-16 Thread Jim Lemon
On 06/16/2012 07:41 AM, @ngel wrote: 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 variab

[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-15 Thread Özgür Asar
Hi, Do you mean printing the results of degree_w(net.101031) and apply(net.101031, 2, mean) in a loop? see ?print to print the results and ?cat as a suporting function. For instance see the toy example below for (i in 1:5){ print('') cat("model",i,"\

Re: [R] Loop Help

2012-05-21 Thread David L Carlson
al Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of David L Carlson > Sent: Monday, May 21, 2012 12:30 PM > To: 'Rui Barradas'; 'bdossman' > Cc: r-help@r-project.org > Subject: Re: [R] Loop Help > > Here is

Re: [R] Loop Help

2012-05-21 Thread David L Carlson
s@r- > project.org] On Behalf Of Rui Barradas > Sent: Saturday, May 19, 2012 9:04 AM > To: bdossman > Cc: r-help@r-project.org > Subject: Re: [R] Loop Help > > Hello, > > The error is that you are trying to use the number of rows of a > character string. > TOWERS[1], TOW

Re: [R] Loop Help

2012-05-19 Thread Rui Barradas
result)) where 'result' is the result of do.call. Hope this helps, Rui Barradas Em 19-05-2012 11:00, r-help-requ...@r-project.org escreveu: Date: Fri, 18 May 2012 16:14:08 -0700 (PDT) From: bdossman To:r-help@r-project.org Subject: [R] Loop Help Message-ID:<1337382848213-4630555.p...

Re: [R] Loop Help

2012-05-19 Thread Simon Knapp
First, what was going wrong: #this creates a character vector, not an object containing your data sets TOWERS <- c("TOWER1","TOWER2","TOWER3","TOWER4","TOWER5","TOWER6","TOWER7") for(i in 1:7){ # this creates a variable named "TOWER.i" (not "TOWER.1, TOWER.2, ..., TOWER.7) # which will ge

[R] Loop Help

2012-05-19 Thread bdossman
Hi all, I am a beginner R user and need some help with a simple loop function. Currently, I have seven datasets (TOWER1,TOWER2...TOWER7) that are all in the same format (same # of col and headers). I am trying to add a new column (factor) to each dataset that simply identifies the dataset. Ultima

Re: [R] R loop help

2010-04-06 Thread casperyc
27;x', 1:4, sep =""), c(2,3,4)) to get all possible combinations, but didnt work how should I proceed? Thanks! casper -- View this message in context: http://n4.nabble.com/R-loop-help-tp1692945p1753626.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] R loop help

2010-03-27 Thread Patrick Burns
An aside to the main question: I don't think that i+1:3 is doing what you think it is. On 26/03/2010 23:01, casperyc wrote: Hi, I am tring to write a loop to compute this, == x1=c( rep(-1,4), rep(1,4) ) x2=c( rep(c(-1,-1,1,1),2)

Re: [R] R loop help

2010-03-26 Thread Jorge Ivan Velez
o recognize xi and xj > > is there any suggestion? > it would be wonderful if there exists a single command that i can use > > My ultimate aim is to find the 55 xixj s of the following data: > http://n4.nabble.com/file/n1692945/test

[R] R loop help

2010-03-26 Thread casperyc
t would be wonderful if there exists a single command that i can use My ultimate aim is to find the 55 xixj s of the following data: http://n4.nabble.com/file/n1692945/test_pic.jpg test_pic.jpg Thanks. -- View this message in context: http://n4.nabble.com/R-loop-help-tp1692945p1692945.html Sent

Re: [R] loop help

2009-06-16 Thread Rolf Turner
On 17/06/2009, at 3:12 PM, dde...@sciborg.uwaterloo.ca wrote: Hi all, I'm stuck trying to get syntax correct for the follwing type of loop. I would like to find the column with the largest value in a given row, and create a new column with a categorical variable indicating which column the high

[R] loop help

2009-06-16 Thread ddepew
Hi all, I'm stuck trying to get syntax correct for the follwing type of loop. I would like to find the column with the largest value in a given row, and create a new column with a categorical variable indicating which column the highest value of "i" comes from. too=data.frame(A=rnorm(10,1)