Dear Dr. Burns, Many thanks for your reply. I figured out what the problem was. I had neglected to put the line out; at the end of the function. Once I did that, everything was fine.
Thanks again, Peter. --- Patrick Burns <[EMAIL PROTECTED]> wrote: > My solution when I run into mysteries like this > is to put > > browser() > > in the function just before or after the line of > interest. > The magnitude and direction of my stupidity usually > become clear quickly. > > Patrick Burns > [EMAIL PROTECTED] > +44 (0)20 8525 0696 > http://www.burns-stat.com > (home of S Poetry and "A Guide for the Unwilling S > User") > > Peter Lauren wrote: > > >I have a function declared thus. > >FirstEigenvectorBoundary.Training <- > >function(InputFileName='C:/Samples2/PT_Amp.txt', > >Header=TRUE, Colour="red") > > > >Inside the function, I have the following call > > > >out<-list(x=Eigenvectors[2:(NumMetricsSelected+1),1], > >y=-0.8, z=NumMetricsSelected); > > > >NumMetricsSelected has the value 2 and Eigenvectors > >has the following form > > [,1] [,2] [,3] > >[1,] 0.6404630 -0.2153989 0.7371638 > >[2,] -0.6081319 0.4439621 0.6580830 > >[3,] 0.4690231 0.8697706 -0.1533503 > > > >When I do it manually at the console, I get the > >correct result. I.e. > > > > > >>out > >> > >> > >$x > >[1] -0.6081319 0.4690231 > > > >$y > >[1] -0.8 > > > >$z > >[1] 2 > > > >However, when I call the function like this > > > > > >>Training<-FirstEigenvectorBoundary.Training() > >> > >> > > > >I get > > > > > >>Training > >> > >> > >$x > >[1] 0.658083 > > > >$y > >[1] -0.8 > > > >$z > >[1] 2 > > > >That is, the $x element has only one value (instead > of > >2) and it is from the wrong part of the matrix. > > > >Can anyone see what I am doing wrong? > > > >Thanks very much, > >Peter. > > > >______________________________________________ > >[email protected] mailing list > >https://stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > > > > > > > > > > > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
