Quantcast

PerformanceAnalytics Figure 13

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

PerformanceAnalytics Figure 13

David Stewart
Hello everyone,

 

I have been following along with the PerformanceAnalytic "Charts and Tables
Overview" document
(http://cran.r-project.org/web/packages/PerformanceAnalytics/vignettes/PA-ch
arts.pdf).  

 

When I use the syntax provided in Figure 13, I get this error:

 

Error in checkData(R, method = "xts") :

  The data cannot be converted into a time series.  If you are trying to
pass in names from a data object with one column, you should use the form
'data[rows, columns, drop = FALSE]'.  Rownames should have standard date
formats, such as '1985-03-15'.

 

I don't know if I am doing something wrong, as I am relatively new to R, or
if the provided syntax is driving this error.  I have had no other errors.  

 

The syntax in particular:

 

> table.CAPM(managers[trailing36.rows, c(manager.col, peers.cols)],

+ managers[trailing36.rows, 8, drop = FALSE], Rf = managers[trailing36.rows,

+ Rf.col, drop = FALSE]

 

All of the data frames seem to contain the appropriate data.  

 

Any suggestions would be welcome.

 

Regard,

David


        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PerformanceAnalytics Figure 13

loconut
I had a similar problem. I was reading data in from an csv file that had been created in MS Excel:

portfolios <- read.csv("C:/Data.csv", sep=",", row.names=1, stringsAsFactors=FALSE)

Then, when attempting to use charts.PerformanceSummary, I got the following error:

Error in checkData(R) :
  The data cannot be converted into a time series.  If you are trying to pass in names from a data object with one column, you should use the form 'data[rows, columns, drop = FALSE]'.

The "fix" was to convert the date format to the European style "1997-03-01" and re-save the data. I quote the word "fix" because I got the same error again a few days later after a reboot. I fixed it the second time by converting the dates to another style and then converting back to the European style - again. Very strange.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PerformanceAnalytics Figure 13

Jeffrey Ryan
CCYY-MM-DD isn't "European style", it is ISO-8601 Standard, which is the only way to properly represent time unambiguously.

PerformanceAnalytics uses xts, which adheres to the global standard set in the aforementioned standard.

Best,
Jeff

Jeffrey Ryan    |    Founder    |    [hidden email]

www.lemnica.com

On Dec 18, 2011, at 3:10 PM, loconut <[hidden email]> wrote:

> I had a similar problem. I was reading data in from an csv file that had been
> created in MS Excel:
>
> portfolios <- read.csv("C:/Data.csv", sep=",", row.names=1,
> stringsAsFactors=FALSE)
>
> Then, when attempting to use charts.PerformanceSummary, I got the following
> error:
>
> Error in checkData(R) :
>  The data cannot be converted into a time series.  If you are trying to
> pass in names from a data object with one column, you should use the form
> 'data[rows, columns, drop = FALSE]'.
>
> The "fix" was to convert the date format to the European style "1997-03-01"
> and re-save the data. I quote the word "fix" because I got the same error
> again a few days later after a reboot. I fixed it the second time by
> converting the dates to another style and then converting back to the
> European style - again. Very strange.
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/PerformanceAnalytics-Figure-13-tp3352312p4211997.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PerformanceAnalytics Figure 13

braverock
On Sun, 2011-12-18 at 17:16 -0600, Jeff Ryan wrote:
> CCYY-MM-DD isn't "European style", it is ISO-8601 Standard, which is
> the only way to properly represent time unambiguously.
>
> PerformanceAnalytics uses xts, which adheres to the global standard
> set in the aforementioned standard.

Of course, we also adhere to the 'format' argument used by as.POSIXct,
see

?strftime

for  details.

Cheers,

   - Brian

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PerformanceAnalytics Figure 13

loconut
In reply to this post by Jeffrey Ryan
To clarify, the format "YYYY-MM-DD" isn't an option for formatting dates in Excel if the locale is set to English (U.S.). If you switch the locale to English (U.K.), or probably any other country, this format option becomes available.
Regards
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PerformanceAnalytics Figure 13

Zachary Mayer
You can use custom formatting to specify a "YYYY-MM-DD" date in Excel.



Sent from my iPhone

On Dec 19, 2011, at 5:15 AM, loconut <[hidden email]> wrote:

> To clarify, the format "YYYY-MM-DD" isn't an option for formatting dates in
> Excel if the locale is set to English (U.S.). If you switch the locale to
> English (U.K.), or probably any other country, this format option becomes
> available.
> Regards
>
> --
> View this message in context: http://r.789695.n4.nabble.com/PerformanceAnalytics-Figure-13-tp3352312p4213544.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PerformanceAnalytics Figure 13

braverock
In reply to this post by loconut
On Mon, 2011-12-19 at 02:14 -0800, loconut wrote:
> To clarify, the format "YYYY-MM-DD" isn't an option for formatting dates in
> Excel if the locale is set to English (U.S.). If you switch the locale to
> English (U.K.), or probably any other country, this format option becomes
> available.
> Regards

Most recent versions of Excel offer an 'ISO-8601' or a
YYY=MM=DD' format, which os correct.  The ommission of that format in
the 'English(United States)' locale hardly counts as a problem for R.
All versions of Excel for at least a decade have also offered a 'custom'
format.

There are more reasons than could be conveniently enumerated to not use
Excel for quantitative finance.

But this is an R list, not an Excel list, so I'll stop there.  

Regards,

    - Brian

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Loading...