Skip to content

Commit

Permalink
pre-release, waiting for R-devel checks
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyuchen committed Feb 27, 2017
1 parent 15f110a commit 2fad917
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 37 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: extdplyr
Type: Package
Title: Data Manipulation Extensions of 'Dplyr' and 'Tidyr'
Version: 0.1.3.9000
Version: 0.1.4
Authors@R: person("Yuchen", "Wang", email = "[email protected]",
role = c("aut", "cre"))
Description: If 'dplyr' is a grammar for data manipulation, 'extdplyr' is like
Expand All @@ -17,4 +17,5 @@ Imports:
tidyr,
lazyeval
RoxygenNote: 6.0.1
Suggests: testthat
Suggests: testthat,
data.table
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# extdplyr 0.1.4

* Added tests for `ind_to_char_` to check compatibility for `tbl_df` and `data.table`.
* Adapted `append_col` and `append_df` from `tidyr`.


# extdplyr 0.1.3

* Added a `NEWS.md` file to track changes to the package.
Expand Down
23 changes: 5 additions & 18 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,14 @@
## R CMD check results
There were no ERRORs or WARNINGs.

win-builder check has 1 note:
There was 1 NOTES on win-builder:

```
New submission
```

* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Yuchen Wang <[email protected]>'
Fixed 2 notes in previous submission.

```
Possibly mis-spelled words in DESCRIPTION:
dplyr (3:45, 7:18, 8:35, 8:63, 10:61)
extdplyr (7:62, 8:44)
tidyr (3:55, 9:6)
Days since last update: 4
```

Fixed description file for title case and single quotes.

```
Non-standard file/directory found at top level:
'examples'
```
I found a problem that could cause `ind_to_char_` to fail when data are grouped as a `grouped_df` object from `dplyr`. This has been fixed in the latest version, and several tests are added to make sure the functions work with various data structures.

This is fixed by adding the folder to `.Rbuildignore`.
36 changes: 19 additions & 17 deletions tests/testthat/test_grp_routine.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,28 @@ test_that("ind_to_char_ works with grouped_df, tbl_df, tbl, data.frame", {
})


library(data.table)
test_that("ind_to_char_ works with tbl_df, tbl, data.frame", {
df <- data.frame(x = 1:5, y = factor(c(letters[1:5])))
ind_df <- data.table(model.matrix(~ x + y - 1, df))
if (requireNamespace("data.table", quietly = TRUE)) {
test_that("ind_to_char_ works with tbl_df, tbl, data.frame", {
df <- data.frame(x = 1:5, y = factor(c(letters[1:5])))
ind_df <- data.table::data.table(model.matrix(~ x + y - 1, df))

# Using SE
df_ret <- ind_to_char_(ind_df, col = "new_y",
from = c("ya", "yb", "yc", "yd", "ye"))
# Using SE
df_ret <- ind_to_char_(ind_df, col = "new_y",
from = c("ya", "yb", "yc", "yd", "ye"))

expect_equal(class(ind_df), class(df_ret))
expect_equal(ncol(df_ret), 2)
expect_equal(df_ret[['new_y']], c("ya", "yb", "yc", "yd", "ye"))
expect_equal(class(ind_df), class(df_ret))
expect_equal(ncol(df_ret), 2)
expect_equal(df_ret[['new_y']], c("ya", "yb", "yc", "yd", "ye"))

df_ret2 <- ind_to_char_(ind_df, col = "new_y",
from = c("ya", "yb", "yc", "yd", "ye"),
remove = FALSE)
df_ret2 <- ind_to_char_(ind_df, col = "new_y",
from = c("ya", "yb", "yc", "yd", "ye"),
remove = FALSE)

expect_equal(class(ind_df), class(df_ret2))
expect_equal(ncol(df_ret2), 7)
expect_equal(df_ret2[["new_y"]], c("ya", "yb", "yc", "yd", "ye"))
})
}

expect_equal(class(ind_df), class(df_ret2))
expect_equal(ncol(df_ret2), 7)
expect_equal(df_ret2[["new_y"]], c("ya", "yb", "yc", "yd", "ye"))
})


0 comments on commit 2fad917

Please sign in to comment.