alas, no vecnorm
On Thu, 4 May 2000, Faheem Mitha wrote:
I wanted a function that would give the euclidean distance of a vector. Then I was happy, because I found vecnorm listed on pg 55 of V&R (3rd edn) which I had just bought today.
Funny, it is on page 55 of the _second_ edition, and not in the third. It is the third edition that is R-aware. Have you really just bought a second edition?
Then I was sad, because R did not have vecnorm. Then I was happy again, because I bethought myself that I could copy the function vecnorm from splus to my code. Then I was sad again because R complained
vecnorm(v)
Error in .Fortran("d2norm", as.integer(length(x)), as.double(x), value =
double(1)) :
C/Fortran function name not in load table
So, after this tempest of emotion, the question still remains: does R have
this function under another name, or was it simply overlooked?
Well, it was not overlooked. R is not an S-PLUS clone, it is similar to S, and AFAIK vecnorm is an S-PLUS extension. vecnorm <- function(x, p=2) sum(x^p)^(1/p) will do almost all of what vecnorm does, if not as fast as the internal function, but do you need the speed? I at least thought vecnorm was not a priority for R.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._