Skip to content

Commit dbcf477

Browse files
authored
Spring cleaning 🧼 (#31)
* Tidy the DESCRIPTION * Use styler * Update snapshots * Update badges * Add package doc * Add RStudio as funder, update CoC * Update pkgdown * Add CODEOWNERS * Back to old snapshot * No Windows + R 3.6 (cannot install deps)
1 parent d67cf10 commit dbcf477

17 files changed

+245
-79
lines changed

‎.github/CODEOWNERS

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CODEOWNERS for usemodels
2+
# https://www.tidyverse.org/development/understudies
3+
.github/CODEOWNERS @topepo @juliasilge

‎.github/CODE_OF_CONDUCT.md

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at [email protected].
63+
All complaints will be reviewed and investigated promptly and fairly.
64+
65+
All community leaders are obligated to respect the privacy and security of the
66+
reporter of any incident.
67+
68+
## Enforcement Guidelines
69+
70+
Community leaders will follow these Community Impact Guidelines in determining
71+
the consequences for any action they deem in violation of this Code of Conduct:
72+
73+
### 1. Correction
74+
75+
**Community Impact**: Use of inappropriate language or other behavior deemed
76+
unprofessional or unwelcome in the community.
77+
78+
**Consequence**: A private, written warning from community leaders, providing
79+
clarity around the nature of the violation and an explanation of why the
80+
behavior was inappropriate. A public apology may be requested.
81+
82+
### 2. Warning
83+
84+
**Community Impact**: A violation through a single incident or series of
85+
actions.
86+
87+
**Consequence**: A warning with consequences for continued behavior. No
88+
interaction with the people involved, including unsolicited interaction with
89+
those enforcing the Code of Conduct, for a specified period of time. This
90+
includes avoiding interactions in community spaces as well as external channels
91+
like social media. Violating these terms may lead to a temporary or permanent
92+
ban.
93+
94+
### 3. Temporary Ban
95+
96+
**Community Impact**: A serious violation of community standards, including
97+
sustained inappropriate behavior.
98+
99+
**Consequence**: A temporary ban from any sort of interaction or public
100+
communication with the community for a specified period of time. No public or
101+
private interaction with the people involved, including unsolicited interaction
102+
with those enforcing the Code of Conduct, is allowed during this period.
103+
Violating these terms may lead to a permanent ban.
104+
105+
### 4. Permanent Ban
106+
107+
**Community Impact**: Demonstrating a pattern of violation of community
108+
standards, including sustained inappropriate behavior, harassment of an
109+
individual, or aggression toward or disparagement of classes of individuals.
110+
111+
**Consequence**: A permanent ban from any sort of public interaction within the
112+
community.
113+
114+
## Attribution
115+
116+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117+
version 2.1, available at
118+
<https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
119+
120+
Community Impact Guidelines were inspired by
121+
[Mozilla's code of conduct enforcement ladder][https://github.com/mozilla/inclusion].
122+
123+
For answers to common questions about this code of conduct, see the FAQ at
124+
<https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.
125+
126+
[homepage]: https://www.contributor-covenant.org

‎.github/workflows/R-CMD-check.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ jobs:
2525
- {os: macOS-latest, r: 'release'}
2626

2727
- {os: windows-latest, r: 'release'}
28-
# Use 3.6 to trigger usage of RTools35
29-
- {os: windows-latest, r: '3.6'}
3028

3129
# Use older ubuntu to maximise backward compatibility
3230
- {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}

‎DESCRIPTION

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ Version: 0.2.0.9000
44
Authors@R: c(
55
person("Max", "Kuhn", , "[email protected]", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2402-136X")),
7-
person("RStudio", role = "cph")
7+
person("RStudio", role = c("cph", "fnd"))
88
)
99
Description: Code snippets to fit models using the tidymodels framework
1010
can be easily created for a given data set.
1111
License: MIT + file LICENSE
12-
URL: https://usemodels.tidymodels.org/, https://github.com/tidymodels/usemodels
12+
URL: https://usemodels.tidymodels.org/,
13+
https://github.com/tidymodels/usemodels
1314
BugReports: https://github.com/tidymodels/usemodels/issues
15+
Depends:
16+
R (>= 3.4)
1417
Imports:
1518
cli,
1619
clipr,
@@ -25,7 +28,8 @@ Suggests:
2528
modeldata,
2629
spelling,
2730
testthat
28-
Config/Needs/website: tidyverse/tidytemplate
31+
Config/Needs/website:
32+
tidyverse/tidytemplate
2933
Config/testthat/edition: 3
3034
Encoding: UTF-8
3135
Language: en-US

‎R/0_imports.R

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#' @keywords internal
2+
"_PACKAGE"
3+
4+
## usethis namespace: start
5+
## usethis namespace: end
6+
NULL
7+
8+
# ------------------------------------------------------------------------------
19

210
#' @import rlang
311
#' @import tune

‎R/messages.R

-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@ string_to_factor_msg <-
3434
"For modeling, it is preferred to encode qualitative data as factors",
3535
"(instead of character)."
3636
)
37-

‎R/misc.R

+21-13
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ y_lvl <- function(rec) {
2020
}
2121
var_roles <- summary(rec)
2222
y_cols <- var_roles$variable[var_roles$role == "outcome"]
23-
y_dat <- rec$template %>% dplyr::select(one_of(y_cols)) %>% dplyr::pull(1)
23+
y_dat <- rec$template %>%
24+
dplyr::select(one_of(y_cols)) %>%
25+
dplyr::pull(1)
2426
length(levels(y_dat))
2527
}
2628

@@ -89,7 +91,7 @@ add_steps_dummy_vars <- function(base, hot = FALSE, add = FALSE, colors = TRUE)
8991
add_comment(dummy_hot_msg, add, colors = colors) %>%
9092
pipe_value(step_dummy(all_nominal_predictors(), one_hot = TRUE))
9193
} else {
92-
base <- base %>%
94+
base <- base %>%
9395
add_comment(dummy_msg, add, colors = colors) %>%
9496
pipe_value(step_dummy(all_nominal_predictors()))
9597
}
@@ -104,8 +106,10 @@ factor_check <- function(base, rec, add, colors = TRUE) {
104106
var_roles <- summary(rec)
105107
nominal <- var_roles$variable[var_roles$type == "nominal"]
106108
is_str <-
107-
purrr::map_lgl(rec$template %>% dplyr::select(dplyr::one_of(nominal)),
108-
rlang::is_character)
109+
purrr::map_lgl(
110+
rec$template %>% dplyr::select(dplyr::one_of(nominal)),
111+
rlang::is_character
112+
)
109113
if (any(is_str)) {
110114
selector <- rlang::expr(one_of(!!!nominal[is_str]))
111115
step_expr <- rlang::expr(step_string2factor(!!selector))
@@ -139,10 +143,12 @@ template_workflow <- function(prefix) {
139143

140144
template_tune_with_grid <- function(prefix, colors = TRUE) {
141145
tune_expr <-
142-
rlang::call2("tune_grid",
143-
sym(paste0(prefix, "_workflow")),
144-
resamples = expr(stop("add your rsample object")),
145-
grid = sym(paste0(prefix, "_grid")))
146+
rlang::call2(
147+
"tune_grid",
148+
sym(paste0(prefix, "_workflow")),
149+
resamples = expr(stop("add your rsample object")),
150+
grid = sym(paste0(prefix, "_grid"))
151+
)
146152
res <- assign_value(paste0(prefix, "_tune"), !!tune_expr)
147153
if (colors) {
148154
res <- sub(
@@ -163,8 +169,10 @@ template_tune_no_grid <- function(prefix, seed = sample.int(10^5, 1), colors = T
163169
grid = expr(stop("add number of candidate points"))
164170
)
165171

166-
res <- c(paste0("set.seed(", seed,")\n"),
167-
assign_value(paste0(prefix, "_tune"), !!tune_expr))
172+
res <- c(
173+
paste0("set.seed(", seed, ")\n"),
174+
assign_value(paste0(prefix, "_tune"), !!tune_expr)
175+
)
168176

169177
if (colors) {
170178
res <- sub(
@@ -186,9 +194,9 @@ template_tune_no_grid <- function(prefix, seed = sample.int(10^5, 1), colors = T
186194
# Take the call to the template function and turn it into a call to `recipe()`
187195
initial_recipe_call <- function(cl) {
188196
cl$tune <- NULL
189-
cl$verbose <- NULL
190-
cl$colors <- NULL
191-
cl$prefix <- NULL
197+
cl$verbose <- NULL
198+
cl$colors <- NULL
199+
cl$prefix <- NULL
192200
rec_cl <- cl
193201
rec_cl[[1]] <- rlang::expr(recipe)
194202
rec_cl

0 commit comments

Comments
 (0)