Skip to content

Commit

Permalink
Merge pull request #8 from ellisvalentiner/v0.1.1
Browse files Browse the repository at this point in the history
v0.1.1
  • Loading branch information
ellisvalentiner authored Nov 12, 2017
2 parents b6171f2 + 925f9af commit fcccb21
Show file tree
Hide file tree
Showing 24 changed files with 348 additions and 36 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ README.Rmd
^_pkgdown\.yml$
^codecov\.yml$
^\.travis\.yml$
^vignettes/*
^CONDUCT\.md$
^CONTRIBUTING\.md$
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ language: r
sudo: false
cache: packages
latex: false
r_packages:
- covr

env:
global:
Expand Down
18 changes: 18 additions & 0 deletions CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# R Consortium and the R Community Code of Conduct

The R Consortium, like the R community as a whole, is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences great successes and continued growth.

Members of the R Consortium and their representatives are bound to follow this R Community Code of Conduct (which is based on the Python Community Code of Conduct). We encourage all members of the R community to likewise follow these guidelines which help steer our interactions and strive to keep R a positive, successful, and growing community.

# R Community Code of Conduct
A member of the R Community is:

Open: Members of the community are open to collaboration, whether it's on projects, working groups, packages, problems, or otherwise. We're receptive to constructive comment and criticism, as the experiences and skill sets of other members contribute to the whole of our efforts. We're accepting of anyone who wishes to take part in our activities, fostering an environment where all can participate and everyone can make a difference.

Considerate: Members of the community are considerate of their peers — other R users. We're thoughtful when addressing the efforts of others, keeping in mind that oftentimes the labor was completed simply for the good of the community. We're attentive in our communications, whether in person or online, and we're tactful when approaching differing views.

Respectful: Members of the community are respectful. We're respectful of others, their positions, their skills, their commitments, and their efforts. We're respectful of the volunteer efforts that permeate the R community. We're respectful of the processes set forth in the community, and we work within them. When we disagree, we are courteous in raising our issues.

Overall, we're good to each other. We contribute to this community not because we have to, but because we want to. If we remember that, these guidelines will come naturally.

Questions/comments/reports? Please write to the Code of Conduct address: [email protected]. (this will email the Board Chair and R Consortium Program manager). Include any available relevant information, including links to any publicly accessible material relating to the matter.
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Contributing

lubridateExtras is an **Open Source** project and there are different ways to contribute.

Please, use [GitHub issues](https://github.com/ellisvalentiner/lubridateExtras/issues) to **report errors/bugs** or to **ask for new features**.

Contributions are welcome in the form of **pull requests**. Please follow these guidelines:

- Write code against the master branch but pull request against the dev branch.
- By making a pull request, you're agreeing to license your code under a [MIT license](https://github.com/ellisvalentiner/lubridateExtras/blob/dev/LICENSE.md).
- Code should be documented and tested.

## Style

### Function/variable naming & general syntax

* Use `snake_case` for function names.

* Avoid function names that conflict with base packages or other popular ones (e.g. `ggplot2`, `dplyr`, `magrittr`, `data.table`).

* Use an `object_verb()` naming scheme for functions that take a common data type or interact with a common API. `object` refers to the data/API and `verb` the primary action. This scheme helps avoid namespace conflicts with packages that may have similar verbs, and makes code readable and easy to auto-complete.

* Functions that manipulate an object/data and return an object/data of the same type, should accept the object/data as the first argument of the function so as to enhance compatibility with the pipe operator (`%>%`)

### Documentation

* All exported package functions should be fully documented with examples.

* When using `roxygen2`, add `#' @noRd` to internal functions.

### Testing

* Changes should pass `R CMD check`/`devtools::check()` on all major platforms.

## Conduct

We adhere to the [R Consortium and the R Community Code of Conduct](https://wiki.r-consortium.org/view/R_Consortium_and_the_R_Community_Code_of_Conduct).
17 changes: 12 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: lubridateExtras
Type: Package
Title: Convenience functions for the lubridate package
Version: 0.1.0
Title: Convenience Functions for Manipulating Datetimes
Version: 0.1.1
Authors@R: c(
person("Ellis", "Valentiner", email = "[email protected]", role = c("aut", "cre")),
person("Geoffrey", "Hannigan", email = "[email protected]", role = c("ctb")))
Expand All @@ -10,11 +10,18 @@ Description: Provides extra functionality to lubridate. Largely consisting of
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Depends:
R (>= 3.1.0)
Imports:
lubridate (>= 1.6.0)
lubridate (>= 1.6.0),
hms (>= 0.3)
Suggests:
knitr
knitr (>= 1.17),
testthat (>= 1.0.2)
Remotes:
tidyverse/lubridate
tidyverse/lubridate,
tidyverse/hms,
yihui/knitr,
r-lib/testthat
VignetteBuilder: knitr
RoxygenNote: 6.0.1
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export(days_ago)
export(days_hence)
export(hms)
export(is.weekday)
export(is.weekend)
export(last_month)
Expand Down
20 changes: 16 additions & 4 deletions R/instants.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#'
#' @examples
#' yesterday()
#' yesterday("GMT")
#' yesterday("UTC")
yesterday <- function(tzone = "") {
as_date(now(tzone) - days(1))
as_date(now(tzone = tzone) - days(1))
}

#' The next day
Expand All @@ -23,9 +23,9 @@ yesterday <- function(tzone = "") {
#'
#' @examples
#' tomorrow()
#' tomorrow("GMT")
#' tomorrow("UTC")
tomorrow <- function(tzone = "") {
as_date(now(tzone) + days(1))
as_date(now(tzone = tzone) + days(1))
}

#' The date x days ago
Expand Down Expand Up @@ -120,3 +120,15 @@ is.weekend <- function(x) {
is.weekday <- function(x) {
wday(x = as_date(x), label = FALSE, abbr = FALSE) %in% 2:6
}

#' Extract time-of-day values
#'
#' @export hms
#' @param x a POSIXct, POSIXlt, Date, chron, yearmon, yearqtr, zoo, zooreg,
#' timeDate, xts, its, ti, jul, timeSeries, or fts object.
#' @return hms object
#' @examples
#' hms("2017-10-22 15:01:00")
hms <- function(x) {
hms::as.hms(strftime(x, format="%H:%M:%S"))
}
8 changes: 7 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ knitr::opts_chunk$set(
comment = "#>",
fig.path = "README-"
)
options(tibble.print_min = 5, tibble.print_max = 5)
options(
tibble.print_min = 5,
tibble.print_max = 5
)
Sys.setenv(TZ = "America/Detroit")
```

# lubridateExtras <img src="man/figures/logo.svg" align="right" height="120" width="139" />
Expand Down Expand Up @@ -48,6 +52,8 @@ tomorrow()
days_ago(7) # equivalent to lubridate::today() - lubridate::days(7)
days_hence(7) # equivalent to lubridate::today() + lubridate::days(7)
hms("2017-10-22 15:33:00") # extracts the time-of-day component
```

## Why lubridateExtras?
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,19 @@ Usage
library(lubridateExtras)

yesterday()
#> [1] "2017-10-11"
#> [1] "2017-10-21"

tomorrow()
#> [1] "2017-10-13"
#> [1] "2017-10-23"

days_ago(7) # equivalent to lubridate::today() - lubridate::days(7)
#> [1] "2017-10-05"
#> [1] "2017-10-15"

days_hence(7) # equivalent to lubridate::today() + lubridate::days(7)
#> [1] "2017-10-19"
#> [1] "2017-10-29"

hms("2017-10-22 15:33:00") # extracts the time-of-day component
#> 15:33:00
```

Why lubridateExtras?
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions docs/articles/intro.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/days_ago.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/days_hence.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fcccb21

Please sign in to comment.