test_that("function returns numeric vector", {
files <- list.files('..\\..\\datasets\\')
close_prices <- df_prices(files, source = '..\\..\\datasets\\')
weights <- c(0.40, 0.40, 0.20)
expect_type(portfolio_returns(close_prices, weights), 'double')
})
test_that("dimensions are correct", {
files <- list.files('..\\..\\datasets\\')
close_prices <- df_prices(files, source = '..\\..\\datasets\\')
weights <- c(0.40, 0.40)
expect_error(portfolio_returns(close_prices, weights), 'Incorrect dimensions of prices and weights')
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.