/usr/lib/R/site-library/lambda.r/unitTests/runit.parse_transforms.1.R is in r-cran-lambda.r 1.1.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | test.parse_transforms_1 <- function() {
Prices(series) %as%
{
series@asset.class <- 'equity'
series@periodicity <- 'daily'
series
}
returns(x) %when% {
x@asset.class == "equity"
x@periodicity == "daily"
} %as% {
x[2:length(x)] / x[1:(length(x) - 1)] - 1
}
ps <- Prices(rnorm(50))
checkEquals(attr(ps,'asset.class'), 'equity')
checkEquals(attr(ps,'periodicity'), 'daily')
rs <- returns(ps)
checkEquals(length(rs), length(ps) - 1)
}
|