Skip to content

Commit 5c5b70e

Browse files
authored
Merge pull request #338 from cmu-delphi/ndefries/rlang-attribution
Attribute code borrowed/modified from `rlang` for use in `as_slide_computation`
2 parents 1eceeb6 + e5ed4d0 commit 5c5b70e

File tree

3 files changed

+74
-5
lines changed

3 files changed

+74
-5
lines changed

DESCRIPTION

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ Authors@R: c(
1414
person("Quang", "Nguyen", role = "ctb"),
1515
person("Evan", "Ray", role = "aut"),
1616
person("Dmitry", "Shemetov", role = "ctb"),
17-
person("Ryan", "Tibshirani", , "[email protected]", role = c("aut", "cre"))
17+
person("Ryan", "Tibshirani", , "[email protected]", role = c("aut", "cre")),
18+
person("Lionel", "Henry", role = "ctb", comment = "Author of included rlang fragments"),
19+
person("Hadley", "Wickham", role = "ctb", comment = "Author of included rlang fragments"),
20+
person("Posit", role = "cph", comment = "Copyright holder of included rlang fragments")
1821
)
1922
Description: This package introduces a common data structure for epidemiological
2023
data reported by location and time, provides another data structure to
2124
work with revisions to these data sets over time, and offers associated
2225
utilities to perform basic signal processing tasks.
2326
License: MIT + file LICENSE
27+
Copyright: file inst/COPYRIGHTS
2428
Imports:
2529
cli,
2630
data.table,

R/utils.R

+45-4
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,57 @@ assert_sufficient_f_args <- function(f, ...) {
187187
#' quosure into a function; functions are returned as-is or with light
188188
#' modifications to calculate `ref_time_value`.
189189
#'
190-
#' This code and documentation borrows heavily from [`rlang::as_function`]
191-
#' (https://github.com/r-lib/rlang/blob/c55f6027928d3104ed449e591e8a225fcaf55e13/R/fn.R#L343-L427).
192-
#'
193190
#' This code extends `rlang::as_function` to create functions that take three
194191
#' arguments. The arguments can be accessed via the idiomatic `.`, `.x`, and
195192
#' `.y`, extended to include `.z`; positional references `..1` and `..2`,
196193
#' extended to include `..3`; and also by `epi[x]_slide`-specific names
197194
#' `.group_key` and `.ref_time_value`.
198195
#'
199-
#' @source https://github.com/r-lib/rlang/blob/c55f6027928d3104ed449e591e8a225fcaf55e13/R/fn.R#L343-L427
196+
#' @source This code and documentation are based on
197+
#' [`as_function`](https://github.com/r-lib/rlang/blob/c55f6027928d3104ed449e591e8a225fcaf55e13/R/fn.R#L343-L427)
198+
#' from Hadley Wickham's `rlang` package.
199+
#'
200+
#' Below is the original license for the `rlang` package.
201+
#'
202+
#'
203+
#' MIT License
204+
#'
205+
#' Copyright (c) 2020 rlang authors
206+
#'
207+
#' Permission is hereby granted, free of charge, to any person obtaining a copy
208+
#' of this software and associated documentation files (the "Software"), to deal
209+
#' in the Software without restriction, including without limitation the rights
210+
#' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
211+
#' copies of the Software, and to permit persons to whom the Software is
212+
#' furnished to do so, subject to the following conditions:
213+
#'
214+
#' The above copyright notice and this permission notice shall be included in all
215+
#' copies or substantial portions of the Software.
216+
#'
217+
#' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
218+
#' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
219+
#' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
220+
#' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
221+
#' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
222+
#' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
223+
#' SOFTWARE.
224+
#'
225+
#'
226+
#' Portions of the original code used in this adaptation:
227+
#' 1. Much of the documentation and examples
228+
#' 2. The general flow of the function, including branching conditions
229+
#' 3. Error conditions and wording
230+
#' 4. The chunk converting a formula into a function, see
231+
#' https://github.com/r-lib/rlang/blob/c55f6027928d3104ed449e591e8a225fcaf55e13/R/fn.R#L411-L418
232+
#'
233+
#' Changes made include:
234+
#' 1. Updates to documentation due to new functionality
235+
#' 2. The removal of function-as-string processing logic and helper arg
236+
#' `env`
237+
#' 3. The addition of an output function wrapper that defines a data mask
238+
#' for evaluating quosures
239+
#' 4. Calling an argument-checking function
240+
#' 5. Replacing rlang error functions with internal error functions
200241
#'
201242
#' @param f A function, one-sided formula, or quosure.
202243
#'

inst/COPYRIGHTS

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Posit is the copyright holder for `rlang` fragments included in the
2+
`as_slide_computation` function and documentation in `utils.R` under the following license:
3+
4+
# MIT License
5+
6+
Copyright (c) 2020 rlang authors
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in all
16+
copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
SOFTWARE.

0 commit comments

Comments
 (0)