Re: [R] vector manipulations

From: <Bill.Venables_at_csiro.au>
Date: Wed, 05 Mar 2008 09:38:33 +1000

No problems with it working. The main problem I have observed is unrealistic expectations. People write an *essentially* non-vectorized function and expect Vectorize to produce a version of it which will out-perform explicit loops every time. No magic bullets in this game.

Bill.

Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA

Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary):  +61 7 3826 7304
Mobile:                         +61 4 8819 4402
Home Phone:                     +61 7 3286 7700
mailto:Bill.Venables_at_csiro.au
http://www.cmis.csiro.au/bill.venables/

-----Original Message-----
From: Duncan Murdoch [mailto:murdoch_at_stats.uwo.ca] Sent: Wednesday, 5 March 2008 9:36 AM
To: Venables, Bill (CMIS, Cleveland)
Cc: r-help_at_r-project.org
Subject: Re: [R] vector manipulations

On 3/4/2008 5:41 PM, Bill.Venables_at_csiro.au wrote:
> Your problem is that your function log1( , ) is not vectorized with
> respect to its arguments. For a function to work in outer(...) it
must
> accept vectors for its first two arguments and it must produce a
> parallel vector of responses.
>
> To quote the help information for outer:
>
> "FUN is called with these two extended vectors as arguments.
Therefore,
> it must be a vectorized function (or the name of one), expecting at
> least two arguments."
>
> Sometimes Vectorize can be used to make a non-vectorized function into
a
> vectorized one, but the results are not always entirely satisfactory
in
> my experience.

What problems have you seen?

Duncan Murdoch



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. Received on Tue 04 Mar 2008 - 23:41:18 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 05 Mar 2008 - 18:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive