You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you need to add "subset = subset" in each of the five periodReturn calls like below. it works for me:
function (x, subset = NULL, type = "arithmetic", leading = TRUE)
{
x.orig <- x
x <- try.xts(x)
all.ret <- cbind(periodReturn(x, "daily",subset = subset, type = type, leading = FALSE),
periodReturn(x, "weekly",subset = subset,type = type),
periodReturn(x, "monthly",subset = subset, type = type, indexAt = "endof"),
periodReturn(x, "quarterly", subset = subset,type = type, indexAt = "endof"),
periodReturn(x, "yearly",subset = subset, type = type))
colnames(all.ret) <- c("daily", "weekly", "monthly", "quarterly",
"yearly")
reclass(all.ret, x.orig)
}
Minimal, reproducible example
[Insertsampledataandcode]
Session Info
[Insertyour sessionInfo() output]
The text was updated successfully, but these errors were encountered:
Description
allReturns ignores subset directive
Expected behavior
allReturns should calculate for given xts subset
you need to add "subset = subset" in each of the five periodReturn calls like below. it works for me:
function (x, subset = NULL, type = "arithmetic", leading = TRUE)
{
x.orig <- x
x <- try.xts(x)
all.ret <- cbind(periodReturn(x, "daily",subset = subset, type = type, leading = FALSE),
periodReturn(x, "weekly",subset = subset,type = type),
periodReturn(x, "monthly",subset = subset, type = type, indexAt = "endof"),
periodReturn(x, "quarterly", subset = subset,type = type, indexAt = "endof"),
periodReturn(x, "yearly",subset = subset, type = type))
colnames(all.ret) <- c("daily", "weekly", "monthly", "quarterly",
"yearly")
reclass(all.ret, x.orig)
}
Minimal, reproducible example
Session Info
The text was updated successfully, but these errors were encountered: