Skip to content
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

Use dttm instead of time #133

Merged
merged 3 commits into from Jul 29, 2016
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -47,6 +47,7 @@ S3method(type_sum,Date)
S3method(type_sum,POSIXt)
S3method(type_sum,data.frame)
S3method(type_sum,default)
S3method(type_sum,difftime)
S3method(type_sum,factor)
S3method(type_sum,ordered)
S3method(type_sum,tbl_df)
Expand Down
4 changes: 3 additions & 1 deletion R/type-sum.r
Expand Up @@ -47,7 +47,9 @@ type_sum.ordered <- function(x) "ord"
#' @export
type_sum.factor <- function(x) "fctr"
#' @export
type_sum.POSIXt <- function(x) "time"
type_sum.POSIXt <- function(x) "dttm"
#' @export
type_sum.difftime <- function(x) "time"
#' @export
type_sum.Date <- function(x) "date"
#' @export
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/output/glimpse/all-35.txt
Expand Up @@ -6,6 +6,6 @@ $ c <lgl> TRUE, FALSE, NA
$ d <chr> "a", "b", NA
$ e <fctr> a, b, NA
$ f <date> 2015-12-10, 2015-12...
$ g <time> 2015-12-09 10:51:35...
$ g <dttm> 2015-12-09 10:51:35...
$ h <list> [1, 2, NA]
$ i <list> [[1, <2, 3>], <4, 5...
2 changes: 1 addition & 1 deletion tests/testthat/output/glimpse/all-50.txt
Expand Up @@ -6,6 +6,6 @@ $ c <lgl> TRUE, FALSE, NA
$ d <chr> "a", "b", NA
$ e <fctr> a, b, NA
$ f <date> 2015-12-10, 2015-12-11, NA
$ g <time> 2015-12-09 10:51:35, 2015-12-09 10...
$ g <dttm> 2015-12-09 10:51:35, 2015-12-09 10...
$ h <list> [1, 2, NA]
$ i <list> [[1, <2, 3>], <4, 5, 6>, NA]
2 changes: 1 addition & 1 deletion tests/testthat/output/glimpse/all-70.txt
Expand Up @@ -6,6 +6,6 @@ $ c <lgl> TRUE, FALSE, NA
$ d <chr> "a", "b", NA
$ e <fctr> a, b, NA
$ f <date> 2015-12-10, 2015-12-11, NA
$ g <time> 2015-12-09 10:51:35, 2015-12-09 10:51:36, NA
$ g <dttm> 2015-12-09 10:51:35, 2015-12-09 10:51:36, NA
$ h <list> [1, 2, NA]
$ i <list> [[1, <2, 3>], <4, 5, 6>, NA]
2 changes: 1 addition & 1 deletion tests/testthat/output/trunc_mat/POSIXlt-8-60.txt
@@ -1,6 +1,6 @@
# A tibble: 12 x 2
x y
<time> <time>
<dttm> <dttm>
1 2016-01-01 12:34:57 <POSIXlt>
2 2016-01-01 12:34:58 <POSIXlt>
3 2016-01-01 12:34:59 <POSIXlt>
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/output/trunc_mat/all--30.txt
Expand Up @@ -6,5 +6,5 @@
3 NA NA NA <NA>
# ... with 5 more variables:
# e <fctr>, f <date>,
# g <time>, h <list>,
# g <dttm>, h <list>,
# i <list>
2 changes: 1 addition & 1 deletion tests/testthat/output/trunc_mat/all--300.txt
@@ -1,6 +1,6 @@
# A tibble: 3 x 9
a b c d e f g h
<dbl> <int> <lgl> <chr> <fctr> <date> <time> <list>
<dbl> <int> <lgl> <chr> <fctr> <date> <dttm> <list>
1 1.0 1 TRUE a a 2015-12-10 2015-12-09 10:51:35 <int [1]>
2 2.5 2 FALSE b b 2015-12-11 2015-12-09 10:51:36 <int [1]>
3 NA NA NA <NA> NA <NA> <NA> <int [1]>
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/output/trunc_mat/all-knit-120.txt
Expand Up @@ -4,7 +4,7 @@ A tibble: 3 x 9

|a |b |c |d |e |f |g |h |i |
|:-----|:-----|:-----|:-----|:------|:----------|:-------------------|:---------|:----------|
|<dbl> |<int> |<lgl> |<chr> |<fctr> |<date> |<time> |<list> |<list> |
|<dbl> |<int> |<lgl> |<chr> |<fctr> |<date> |<dttm> |<list> |<list> |
|1.0 |1 |TRUE |a |a |2015-12-10 |2015-12-09 10:51:35 |<int [1]> |<list [2]> |
|2.5 |2 |FALSE |b |b |2015-12-11 |2015-12-09 10:51:36 |<int [1]> |<list [1]> |
|NA |NA |NA |<NA> |NA |NA |NA |<int [1]> |<list [1]> |
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/output/trunc_mat/all-knit-60.txt
Expand Up @@ -9,4 +9,4 @@ A tibble: 3 x 9
|2.5 |2 |FALSE |b |b |2015-12-11 |
|NA |NA |NA |<NA> |NA |NA |

(with 3 more variables: g <time>, h <list>, i <list>)
(with 3 more variables: g <dttm>, h <list>, i <list>)
6 changes: 5 additions & 1 deletion tests/testthat/test-obj-sum.R
Expand Up @@ -25,7 +25,11 @@ test_that("common data vectors treated as atomic", {
expect_equal(obj_sum(factor(1:3)), "fctr [3]")
expect_equal(obj_sum(ordered(1:3)), "ord [3]")
expect_equal(obj_sum(Sys.Date() + 1:3), "date [3]")
expect_equal(obj_sum(Sys.time() + 1:3), "time [3]")
expect_equal(obj_sum(Sys.time() + 1:3), "dttm [3]")
})

test_that("difftime is shown as time", {
expect_equal(obj_sum(Sys.time() - Sys.time() + 1:3), "time [3]")
})


Expand Down