Skip to content
Prev 345358 / 398500 Next

converting individual data series to natural log (continuously compounded return)

Upananda,

I don't know your fut data, next time would help a simple dput(fut). Taking
into account the error message check the following:

library(PerformanceAnalytics)
df <- data.frame( sample(10)/100+100, seq(as.Date("2014-10-22"),
as.Date("2014-10-31"), by="day"))
str(df)
Return.calculate(df, "log")
#Error en checkData(prices, 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'.
df <- data.frame( sample(10)/100+100, row.names=seq(as.Date("2014-10-22"),
as.Date("2014-10-31"), by="day"))
str(df)
Return.calculate(df, "log")
df <- xts( sample(10)/100+100, order.by=seq(as.Date("2014-10-22"),
as.Date("2014-10-31"), by="day"))
str(df)
Return.calculate(df, "log")

If you are going to use the PerformanceAnalytics package I highly recommend
you to checkl the xts package.

Daniel Merino



2014-10-31 15:24 GMT-03:00 Upananda Pani <upananda.pani at gmail.com>: