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 a
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., L-6
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 t
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" :
th
rom: 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 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&M 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 vector
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
operation
8 matches
Mail list logo