[R-SIG-Finance] chart.PerformanceAnalytics(), character string is not in a standard unambiguous format

Brian G. Peterson brian at braverock.com
Wed Jun 17 23:00:10 CEST 2009


Return.calculate doesn't change your index.

We're attempting to address this in the version of code we're trying to 
get ready to release to CRAN by using xts internally.  This will fail 
more quickly and obviously "up front" rather than getting further into a 
process.

You should be able to apply class Date or YearMon to your index using 
the appropriate format string.

Regards,

   - Brian

Khanh Nguyen wrote:
> Thank you Dr. Zivot,
>
> I realized it has to do with the dates, but it is a nuisance though
> because the my object is created by Return.calculate(), which is part
> of PerformanceAnalytics.
>
> -k
>
> On Wed, Jun 17, 2009 at 4:47 PM, Eric Zivot<ezivot at u.washington.edu> wrote:
>   
>> I get this error a lot too. The problem is specifying dates as with just
>> month and year information. My guess is that chart.PerfromanceAnalytics() is
>> trying to create a zoo object with your date information using the as.Date()
>> function to create the time index. Date class wants dates in the form
>> mm/dd/yyyy format. It does not recognize date characters with just month and
>> year. For this, it is best to use the yearmon class in zoo explicitly.
>>
>> ****************************************************************
>> *  Eric Zivot                                                  *
>> *  Professor and Gary Waterman Distinguished Scholar           *
>> *  Department of Economics                                     *
>> *  Adjunct Professor of Finance                                *
>> *  Adjunct Professor of Statistics
>> *  Box 353330                  email:  ezivot at u.washington.edu *
>> *  University of Washington    phone:  206-543-6715            *
>> *  Seattle, WA 98195-3330                                      *
>>                                               *
>> *  www:  http://faculty.washington.edu/ezivot                  *
>> ****************************************************************
>>
>> On Wed, 17 Jun 2009, Khanh Nguyen wrote:
>>
>>     
>>> Hi all,
>>>
>>> I ran into this error "Error in fromchar(x) : character string is not
>>> in a standard unambiguous format"" when I run
>>> charts.PerformanceSummary(). I guess that I probably messed up the
>>> dates in my data somehow.
>>>
>>>       
>>>> z <- Return.calculate(stb.agg$STB.Close, method=c("compound", "simple"))
>>>> #stb.agg is my monthly price history
>>>> head(z)
>>>>         
>>>                STB
>>> Aug 2006  0.01250428
>>> Sep 2006  0.05904603
>>> Oct 2006 -0.05970026
>>> Nov 2006  0.05846646
>>> Dec 2006  0.09671211
>>> Jan 2007  0.26135075
>>>
>>>       
>>>> dput(z)
>>>>         
>>> structure(c(0.0125042761200924, 0.059046028746296, -0.0597002649488925,
>>> 0.0584664584999639, 0.0967121147037853, 0.261350754509795,
>>> 0.084761454787754,
>>> 0.281618134192335, -0.050301925509296, 0.127002576668413,
>>> -0.229431460030798,
>>> -0.191458836140774, -0.0185289083290332, 0.268858114855369,
>>> -0.0363007156717821,
>>> 0.0147123648065453, -0.0448028245368759, -0.0153917235834742,
>>> -0.225195932349637, -0.327933538473546, -0.102059501725719,
>>> -0.313061498255964,
>>> -0.112165043352160, 0.214704682668345, 0.269509471872135,
>>> -0.261070603226270,
>>> -0.0877756108823857, -0.0811901547300131, -0.0883691504500903,
>>> -0.0501497836854714, -0.167573700159399, 0.090384061468269,
>>> 0.259511195485085,
>>> 0.232622295268754, 0.360441426734209), .Dim = c(35L, 1L), .Dimnames =
>>> list(
>>>   c("Aug 2006", "Sep 2006", "Oct 2006", "Nov 2006", "Dec 2006",
>>>   "Jan 2007", "Feb 2007", "Mar 2007", "Apr 2007", "May 2007",
>>>   "Jun 2007", "Jul 2007", "Aug 2007", "Sep 2007", "Oct 2007",
>>>   "Nov 2007", "Dec 2007", "Jan 2008", "Feb 2008", "Mar 2008",
>>>   "Apr 2008", "May 2008", "Jun 2008", "Jul 2008", "Aug 2008",
>>>   "Sep 2008", "Oct 2008", "Nov 2008", "Dec 2008", "Jan 2009",
>>>   "Feb 2009", "Mar 2009", "Apr 2009", "May 2009", "Jun 2009"
>>>   ), "STB"), index = structure(c(2006.58333333333, 2006.66666666667,
>>> 2006.75, 2006.83333333333, 2006.91666666667, 2007, 2007.08333333333,
>>> 2007.16666666667, 2007.25, 2007.33333333333, 2007.41666666667,
>>> 2007.5, 2007.58333333333, 2007.66666666667, 2007.75, 2007.83333333333,
>>> 2007.91666666667, 2008, 2008.08333333333, 2008.16666666667, 2008.25,
>>> 2008.33333333333, 2008.41666666667, 2008.5, 2008.58333333333,
>>> 2008.66666666667, 2008.75, 2008.83333333333, 2008.91666666667,
>>> 2009, 2009.08333333333, 2009.16666666667, 2009.25, 2009.33333333333,
>>> 2009.41666666667), class = "yearmon"), class = "zoo")
>>>
>>>       
>>>> charts.PerformanceSummary(z)
>>>>         
>>> Error in fromchar(x) :
>>>  character string is not in a standard unambiguous format
>>>
>>>
>>> Thanks.
>>>
>>> -k
>>>
>>> _______________________________________________
>>> R-SIG-Finance at stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>> -- Subscriber-posting only.
>>> -- If you want to post, subscribe first.
>>>
>>>       
>>
>>     
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>   


-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list