[R] Debug help

Eduard Pieterse (Macquarie Securities) Eduard.Pieterse at macquarie.com
Wed Feb 4 15:09:51 CET 2009


Thanks Duncan,

I am translating code from Matlab into R and am still finding my feet in
R.
I first run TriskellData and the compute_strategy. In Matlab this is a
function, so I would be looking to do the same in R. 
The bug is in compute_strategy. I would appreciate any help you can
give.

Thanks,
Eduard

-----Original Message-----
From: Duncan Murdoch [mailto:murdoch at stats.uwo.ca] 
Sent: 04 February 2009 14:04
To: Eduard Pieterse (Macquarie Securities)
Cc: r-help at r-project.org
Subject: Re: [R] Debug help

On 2/4/2009 6:28 AM, ehxpieterse wrote:
> Hi,
> 
> I am getting the following error: argument is of length zero
> 
> My code:
> temp <- 0
> for (j in 1 : 3) {
> for (k in 1 : 12) {
> temp <- temp + as.double(C[k, (q - 1) * 3 + j]) * 
> as.double(m_ret_reb[i + k
> - 1, j+1])
> }
> }
> 
> Why would R handle my temp variable as numeric(0)?

You need to send a reproducible example if you want an answer.  It's
more likely a problem with C or m_ret_reb or q, and we don't have those.

Duncan Murdoch

If there is any advice in this email, it is general advice only and has been prepared by Macquarie Group or one of its related entities (“Macquarie”). 

Macquarie has made every reasonable effort to ensure the information provided is correct, but Macquarie makes no representation nor any warranty as to whether the information is accurate, complete or up to date. To the extent permitted by law, Macquarie accepts no responsibility for any errors or misstatements, negligent or otherwise. The information provided may be based on assumptions or market conditions and may change without notice. 
Macquarie, its associates, officers or employees may also have interests in the financial products referred to in this information by acting in various roles. They may buy or sell the financial products as principal or agent and as such may effect transactions which are not consistent with any recommendations (if any in this information).  Macquarie or its associates may also receive fees or brokerage for acting in the above capacities.

The information in this email is confidential. If you are not the intended recipient, you are not authorised to use the information in this email in any way. Macquarie does not guarantee the integrity of any emails or attached files. The view or opinions expressed are the author's own and may not reflect the view or opinions of Macquarie.

Electronic communications carried within the Macquarie system may be monitored.



More information about the R-help mailing list