Re: [R] Help with "For" instruction

2011-01-04 Thread Sarah Goslee
You need to swap the get and paste commands - paste() creates the string filename that get() acts on. As already explained, using a list is much nicer. Sarah 2011/1/4 André Dias : > Hi > > I was doing > > for (i in 1:length(database)) > assign(paste("distancematrix",i,sep=""), dist(paste(get("da

Re: [R] Help with "For" instruction

2011-01-04 Thread André Dias
Hi I was doing for (i in 1:length(database)) assign(paste("distancematrix",i,sep=""), dist(paste(get("database", i, sep="") but i really did not know what I was doing. I will try your way. But I still don't understnad how the get function works. What woud be more r-ish then get() ? thanks

Re: [R] Help with "For" instruction

2011-01-04 Thread Greg Snow
p-boun...@r- > project.org] On Behalf Of André Dias > Sent: Tuesday, January 04, 2011 10:55 AM > To: Sarah Goslee > Cc: r-help@r-project.org > Subject: Re: [R] Help with "For" instruction > > hi > > how do I exactly use the get(). I am reading the help for get

Re: [R] Help with "For" instruction

2011-01-04 Thread Sarah Goslee
2011/1/4 André Dias : > hi > > how do I exactly use the get(). I am reading the help for get() but the way > I am using it causes an error/ > So how are you using it? It's so much easier to explain what you're doing wrong if I know what you're doing. Without a reproducible example I can't show yo

Re: [R] Help with "For" instruction

2011-01-04 Thread André Dias
hi how do I exactly use the get(). I am reading the help for get() but the way I am using it causes an error/ thanks ADias 2011/1/4 Sarah Goslee > With get(). > > On Tue, Jan 4, 2011 at 11:58 AM, ADias wrote: > > > > Hi, > > > > Still with the above problem: > > > > But for instance, i have a

Re: [R] Help with "For" instruction

2011-01-04 Thread ADias
Hi, Still with the above problem: But for instance, i have a data base with 30 variables and I created an object each with one varibale missing: DataBase - has 30 variables DataBase1 has 29 variables with the 1st variable gone DataBase2 has 29 variables with the 2nd variable gone for(i in 1:le

Re: [R] Help with "For" instruction

2011-01-04 Thread ADias
Hi thank you all. I think I have what I need to solve my problem. Regards, A.Dias -- View this message in context: http://r.789695.n4.nabble.com/Help-with-For-instruction-tp3173074p3173386.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Help with "For" instruction

2011-01-03 Thread David Winsemius
On Jan 4, 2011, at 1:00 AM, ADias wrote: Hi, I am having a problem in doing something similar to this example: Suppose I have this vector a, and from it I wish to create 5 other vector each one with less one value than what object a has So I have "a" a<-c(1,2,3,4,5) and I want a1 that

Re: [R] Help with "For" instruction

2011-01-03 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of ADias > Sent: Monday, January 03, 2011 10:00 PM > To: r-help@r-project.org > Subject: [R] Help with "For" instruction > > > Hi, > &g

[R] Help with "For" instruction

2011-01-03 Thread ADias
Hi, I am having a problem in doing something similar to this example: Suppose I have this vector a, and from it I wish to create 5 other vector each one with less one value than what object a has So I have "a" a<-c(1,2,3,4,5) and I want a1 that shoud have (2,3,4,5) a2 that should have (1,3,4,