Skip to content

Fix as xts #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tidyquant
Type: Package
Title: Tidy Quantitative Financial Analysis
Version: 0.5.1
Version: 0.5.1.9001
Date: 2017-04-19
Authors@R: c(
person("Matt", "Dancho", email = "mdancho@business-science.io", role = c("aut", "cre")),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## tidyquant 0.5.1.9001

* Fixes:
* Fixed an issue where backticked columns such as numbers or multiple words were not able to be recognized when calling `as_xts()`.
* Fixed 2 tests where the results of `tq_get(get = "stock.prices")` were 1 or 2 rows off of what the tests expected. This likely has to do with the new yahoo finance API.

## tidyquant 0.5.1

* Improvements
Expand Down
5 changes: 2 additions & 3 deletions R/as_xts.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ as_xts_ <- function(x, date_col = NULL, ...) {
}

# Select columns and reorder
date <- x %>% dplyr::select_(date_col)
not_date_names <- names(x)[names(x) != date_col]
not_date <- x %>% dplyr::select_(.dots = as.list(not_date_names))
date <- x %>% dplyr::select_(date_col)
not_date <- x %>% dplyr::select(-dplyr::matches(date_col))
x <- dplyr::bind_cols(date, not_date)

# Format order.by
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_tq_get_stock_prices.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test_that("Test 1 returns tibble with correct rows and columns.", {
# Tibble
expect_is(test1, "tbl")
# Rows
expect_equal(nrow(test1), 104)
expect_equal(nrow(test1), 103)
# Columns
expect_equal(ncol(test1), 7)
})
Expand All @@ -25,7 +25,7 @@ test_that("Test 2 returns tibble with correct rows and columns.", {
# Tibble
expect_is(test2, "tbl")
# Rows
expect_equal(nrow(test2), 208)
expect_equal(nrow(test2), 206)
# Columns
expect_equal(ncol(test2), 8)
})
Expand Down