[R] strange strsplit gsub problem 0 is this a bug or a string length limitation?

tradenet nodecorum at yahoo.com
Fri Jul 10 17:16:22 CEST 2009


Thanks Marc.

I forwarded the suggestion to Dr. Wuertz and Dr. Chalabi at Rmetrics.

Warm regards,

Andrew Borden



Marc Schwartz-3 wrote:
> 
> On Jul 10, 2009, at 9:07 AM, tradenet wrote:
> 
>>
>> Thanks Marc!
>>
>> I just found that the ~500 char limitation via an online search for  
>> the
>> specs for the formula class
>> The rmetrics library I'm using get's it's character array of assets by
>> parsing a formula passed as an input parameter to the  
>> portfolioBacktest
>> function.  Can I copy the portfolioBacktest function from the  
>> source, call
>> it portfolioBackest_hack, add an additional pamater, an array of asset
>> names, and have my version use this argument instead of parsing the  
>> formula?
>> I'm fairly new to R so I don't know if R will find my function and  
>> if my
>> function will find the other fPortfolio functions that may be  
>> referenced by
>> the original, non "_hack" version of the function.
>>
>> Warm regards,
>>
>> Andrew
> 
> Hi Andrew,
> 
> Happy to help.
> 
> In terms of your proposal as a short term fix, it may be possible to  
> do that. If you do create a new local function and call it directly,  
> it will be seen instead of the package default version of the same  
> function. However, without reviewing the code and package in detail,  
> you have to be careful about other function dependencies and namespace  
> issues that may be present.  I would go ahead and try it to see it it  
> works.
> 
> A better and longer term approach would be to have the function  
> author(s) modify the way in which they manipulate the formula object.  
> They may wish to review this thread from 2001:
> 
>    https://stat.ethz.ch/pipermail/r-help/2001-August/014628.html
> 
> Back then, the as.character() limit was 60 and was increased by Prof.  
> Ripley to 500 in response to that discussion.
> 
> However, in that thread, Prof. Ripley also proposes a better way of  
> manipulating the formula object passed to the function. That approach  
> uses deparse() rather than using as.character().
> 
> HTH,
> 
> Marc Schwartz
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/strange-strsplit-gsub-problem-0-is-this-a-bug-or-a-string-length-limitation--tp24426457p24429282.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list