Here are the code and data file. I’m not sure if I put too much unrelated
information here.
My goal is to factor out volatilities from the data. I hope I can get sigV <-
impVolC(callM, K, T, F, r), which has five vectors as input, and one vector as
output. The length of all those six vectors
Sorry, misread your comment, I agree. 4/2 has one arithmetic operation, (1/2)*4
has two to accomplish the same calculation.
On September 20, 2018 1:53:03 PM PDT, "MacQueen, Don"
wrote:
>You're asking me?
>
>I prefer
>> 4/2
>[1] 2
>
>not
>> 1/2*4
>[1] 2
>
>(I think that's what I said)
>
>And if
You're asking me?
I prefer
> 4/2
[1] 2
not
> 1/2*4
[1] 2
(I think that's what I said)
And if I did want to multiply by the reciprocal, which does happen from time to
time, I'd certainly do it this way:
(1/2)*4
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave.,
re: your last comment... why do you prefer to multiply by the reciprocal?
On September 20, 2018 10:56:22 AM PDT, "MacQueen, Don via R-help"
wrote:
>In addition to what the other said, if callM is a vector then an
>expression of the form
> if (callM <= call0)
>is inappropriate. Objects inside
In addition to what the other said, if callM is a vector then an expression of
the form
if (callM <= call0)
is inappropriate. Objects inside the parentheses of if() should have length
one. For example,
> if (1:5 < 3) 'a' else 'b'
[1] "a"
Warning message:
In if (1:5 < 3) "a" else "b" :
lp On Behalf Of Lynette Chang
> Sent: Thursday, September 20, 2018 10:09 AM
> To: r-help@r-project.org
> Subject: [R] How to vectorize this function
>
> Hello everyone,
>
> I’ve a function with five input argument and one output number.
> impVolC <
instead of the loop.
David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77843-4352
-Original Message-
From: R-help On Behalf Of Lynette Chang
Sent: Thursday, September 20, 2018 10:09 AM
To: r-help@r-project.org
Subject: [R] How to vectorize this func
Hello everyone,
I’ve a function with five input argument and one output number.
impVolC <- function(callM, K, T, F, r)
I hope this function can take five vectors as input, then return one
vector as output. My vectorization ran into problems with the nested if-else
Isn't a vector of vectors usually considered a matrix? So if you want to
vectorize a vector function you would normally rewrite it to operate on
matrices.
---
Jeff Newmiller The . . Go Live...
Dear R-users
I am trying to vectorize a function so that it can handle two vectors of
inputs. I want the function to use phi (a function), k[1] and t[1] for the
first price, and so on for the second, third and fourth price. I tried to do
the mapply, but I dont know how to specify to R what input
On Aug 26, 2011, at 2:43 PM, Newbie wrote:
Dear R-users
I am trying to vectorize a function so that it can handle two
vectors of
inputs. I want the function to use phi (a function), k[1] and t[1]
for the
first price, and so on for the second, third and fourth price.
? mapply
I tried
Thank you for the quick response! I think you are on the right track - but is
there any way of calling (is that the word for it) the function price_call
in the mapply, so that this price_call function is changed to handle
vectors. I believe that this should, in theory if it is correct, make the
On Aug 26, 2011, at 4:52 PM, Newbie wrote:
Thank you for the quick response! I think you are on the right track
- but is
there any way of calling (is that the word for it) the function
price_call
in the mapply, so that this price_call function is changed to handle
vectors. I believe that
13 matches
Mail list logo