stephen sefick
2008-Oct-01 13:39 UTC
[R] for loop question Documentation and its application for calculating euclidean distance on MDS ordination axis scores
?for doesn't return anything help.search("for") doesn't return anything- Is the for loop so prevelant in computer programing that the documentation is implicit or is R paradigm to discourage the use of the for loop. I will post data probably tonight, but here is my problem. I have preformed an MDS on a set of data. I have the scores of the four axes that are the optimal solution. I want to calculate the euclidean distance between time steps of the ordination. My thought is to use a for loop- calculate distance march to april then calculate the distance from april to may ... Is this the proper way of going about this axis1 axis2 axis3 axis4 march 3 4 6 3 april 5 7 8 5 may 7 3 1 9 ..... thanks Stephen The data is at home and I will post it once I have fooled around with the for loop - if I can not figure it out, but this is the general set up of the problem -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
Gabor Grothendieck
2008-Oct-01 13:42 UTC
[R] for loop question Documentation and its application for calculating euclidean distance on MDS ordination axis scores
One must write ?"for" presumably since for is a reserved word in R. On Wed, Oct 1, 2008 at 9:39 AM, stephen sefick <ssefick at gmail.com> wrote:> ?for doesn't return anything help.search("for") doesn't return anything- > Is the for loop so prevelant in computer programing that the > documentation is implicit or is R paradigm to discourage the use of > the for loop. > > I will post data probably tonight, but here is my problem. I have > preformed an MDS on a set of data. I have the scores of the four axes > that > are the optimal solution. I want to calculate the euclidean distance > between time steps of the ordination. My thought is to use a for > loop- > calculate distance march to april then calculate the distance from > april to may ... Is this the proper way of going about this > > axis1 axis2 axis3 axis4 > march 3 4 6 3 > april 5 7 8 5 > may 7 3 1 9 > ..... > > thanks > > Stephen > > The data is at home and I will post it once I have fooled around with > the for loop - if I can not figure it out, but this is the general set > up of the problem > -- > Stephen Sefick > Research Scientist > Southeastern Natural Sciences Academy > > Let's not spend our time and resources thinking about things that are > so little or so large that all they really do for us is puff us up and > make us feel like gods. We are mammals, and have not exhausted the > annoying little problems of being mammals. > > -K. Mullis > > ______________________________________________ > R-help at 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. >
Gábor Csárdi
2008-Oct-01 13:44 UTC
[R] for loop question Documentation and its application for calculating euclidean distance on MDS ordination axis scores
Actually, help.search("for") finds Control(base) Control Flow which is exactly where 'for' is documented. In general, if you want the manual page of reserved words, then you'll have to quote them: ?"for" Gabor On Wed, Oct 1, 2008 at 3:39 PM, stephen sefick <ssefick at gmail.com> wrote:> ?for doesn't return anything help.search("for") doesn't return anything- > Is the for loop so prevelant in computer programing that the > documentation is implicit or is R paradigm to discourage the use of > the for loop. >[...] -- Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
Ben Bolker
2008-Oct-01 13:58 UTC
[R] for loop question Documentation and its application for calculating euclidean distance on MDS ordination axis scores
> I will post data probably tonight, but here is my problem. I have > preformed an MDS on a set of data. I have the scores of the four axes > that > are the optimal solution. I want to calculate the euclidean distance > between time steps of the ordination.See ?dist for a much faster solution ... [saying a little more to make Gmane happy] I wouldn't say for loops are "discouraged", but there are often faster ways to do things in R. Ben Bolker
Seemingly Similar Threads
- I cannot get species scores to plot with site scores in MDS when I use a distance matrix as input. Problems with NA's?
- label of second y-axis in xyplot (lattice)
- squared euclidean distance
- relative euclidean distance
- Euclidean Distance Matrix Analysis (EDMA) in R?