Skip to content

Commit f7a771c

Browse files
committed
Merge commit '415ae254b9e4a0f74656b03e27dca2c4034d5027'
2 parents 1ef1f23 + 415ae25 commit f7a771c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1074
-619
lines changed

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

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ on:
99
branches: [main, master]
1010
pull_request:
1111
branches: [main, master]
12+
workflow_dispatch:
1213

13-
name: R-CMD-check
14+
name: R-CMD-check.yaml
15+
16+
permissions: read-all
1417

1518
jobs:
1619
R-CMD-check:
@@ -25,21 +28,25 @@ jobs:
2528
- {os: macos-latest, r: 'release'}
2629

2730
- {os: windows-latest, r: 'release'}
28-
# use 4.1 to check with rtools40's older compiler
29-
- {os: windows-latest, r: '4.1'}
31+
# use 4.0 or 4.1 to check with rtools40's older compiler
32+
- {os: windows-latest, r: 'oldrel-4'}
3033

31-
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
32-
- {os: ubuntu-latest, r: 'release'}
33-
- {os: ubuntu-latest, r: 'oldrel-1'}
34-
- {os: ubuntu-latest, r: 'oldrel-2'}
35-
- {os: ubuntu-latest, r: 'oldrel-3'}
34+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
35+
- {os: ubuntu-latest, r: 'release'}
36+
- {os: ubuntu-latest, r: 'oldrel-1'}
37+
- {os: ubuntu-latest, r: 'oldrel-2'}
38+
- {os: ubuntu-latest, r: 'oldrel-3'}
39+
#- {os: ubuntu-latest, r: 'oldrel-4'}
3640

3741
env:
3842
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3943
R_KEEP_PKG_SOURCE: yes
44+
CXX14: g++
45+
CXX14STD: -std=c++1y
46+
CXX14FLAGS: -Wall -g -02
4047

4148
steps:
42-
- uses: actions/checkout@v3
49+
- uses: actions/checkout@v4
4350

4451
- uses: r-lib/actions/setup-pandoc@v2
4552

@@ -57,3 +64,8 @@ jobs:
5764
- uses: r-lib/actions/check-r-package@v2
5865
with:
5966
upload-snapshots: true
67+
68+
- name: Show testthat output
69+
if: always()
70+
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
71+
shell: bash

.github/workflows/pkgdown.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ on:
99
types: [published]
1010
workflow_dispatch:
1111

12-
name: pkgdown
12+
name: pkgdown.yaml
13+
14+
permissions: read-all
1315

1416
jobs:
1517
pkgdown:
@@ -19,8 +21,10 @@ jobs:
1921
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2022
env:
2123
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
24+
permissions:
25+
contents: write
2226
steps:
23-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2428

2529
- uses: r-lib/actions/setup-pandoc@v2
2630

@@ -39,7 +43,7 @@ jobs:
3943

4044
- name: Deploy to GitHub pages 🚀
4145
if: github.event_name != 'pull_request'
42-
uses: JamesIves/github-pages-deploy-action@v4.4.1
46+
uses: JamesIves/github-pages-deploy-action@v4.5.0
4347
with:
4448
clean: false
4549
branch: gh-pages

.github/workflows/pr-commands.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
issue_comment:
55
types: [created]
66

7-
name: Commands
7+
name: pr-commands.yaml
8+
9+
permissions: read-all
810

911
jobs:
1012
document:
@@ -13,8 +15,10 @@ jobs:
1315
runs-on: ubuntu-latest
1416
env:
1517
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
permissions:
19+
contents: write
1620
steps:
17-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
1822

1923
- uses: r-lib/actions/pr-fetch@v2
2024
with:
@@ -50,8 +54,10 @@ jobs:
5054
runs-on: ubuntu-latest
5155
env:
5256
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
57+
permissions:
58+
contents: write
5359
steps:
54-
- uses: actions/checkout@v3
60+
- uses: actions/checkout@v4
5561

5662
- uses: r-lib/actions/pr-fetch@v2
5763
with:

.github/workflows/test-coverage.yaml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ on:
66
pull_request:
77
branches: [main, master]
88

9-
name: test-coverage
9+
name: test-coverage.yaml
10+
11+
permissions: read-all
1012

1113
jobs:
1214
test-coverage:
@@ -15,36 +17,45 @@ jobs:
1517
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1618

1719
steps:
18-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
1921

2022
- uses: r-lib/actions/setup-r@v2
2123
with:
2224
use-public-rspm: true
2325

2426
- uses: r-lib/actions/setup-r-dependencies@v2
2527
with:
26-
extra-packages: any::covr
28+
extra-packages: any::covr, any::xml2
2729
needs: coverage
2830

2931
- name: Test coverage
3032
run: |
31-
covr::codecov(
33+
cov <- covr::package_coverage(
3234
quiet = FALSE,
3335
clean = FALSE,
34-
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
36+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3537
)
38+
covr::to_cobertura(cov)
3639
shell: Rscript {0}
3740

41+
- uses: codecov/codecov-action@v4
42+
with:
43+
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
44+
file: ./cobertura.xml
45+
plugin: noop
46+
disable_search: true
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
3849
- name: Show testthat output
3950
if: always()
4051
run: |
4152
## --------------------------------------------------------------------
42-
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
53+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
4354
shell: bash
4455

4556
- name: Upload test results
4657
if: failure()
47-
uses: actions/upload-artifact@v3
58+
uses: actions/upload-artifact@v4
4859
with:
4960
name: coverage-test-failures
5061
path: ${{ runner.temp }}/package

DESCRIPTION

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ Imports:
2424
generics (>= 0.1.2),
2525
glue (>= 1.6.2),
2626
hardhat (>= 1.0.0),
27-
modelenv (>= 0.1.0),
28-
parsnip (>= 1.2.1.9004),
27+
modelenv (>= 0.2.0.9000),
28+
parsnip (>= 1.0.2),
29+
philentropy (>= 0.9.0),
2930
prettyunits (>= 1.1.0),
30-
Rfast (>= 2.0.6),
3131
rlang (>= 1.0.6),
3232
rsample (>= 1.0.0),
3333
stats,
@@ -49,6 +49,8 @@ Suggests:
4949
rmarkdown,
5050
testthat (>= 3.0.0),
5151
workflows (>= 1.1.2)
52+
Remotes:
53+
tidymodels/modelenv
5254
Config/Needs/website: pkgdown, tidymodels, tidyverse, palmerpenguins,
5355
patchwork, ggforce, tidyverse/tidytemplate
5456
Config/testthat/edition: 3

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# tidyclust (development version)
22

3+
* The philentropy package is now used to calculate distances rather than Rfast. (#199)
4+
35
# tidyclust 0.2.3
46

57
* Update to fix revdep issue for clustMixType. (#190)

R/aaa.R

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,47 @@
33

44
utils::globalVariables(
55
c(
6-
".", "..object", ".cluster", ".iter_config", ".iter_model",
7-
".iter_preprocessor", ".msg_model", ".submodels", "call_info", "cluster",
8-
"component", "component_id", "compute_intercept", "data", "dist", "engine",
9-
"engine2", "exposed", "func", "id", "iteration", "lab", "name", "neighbor",
10-
"new_data", "object", "orig_label", "original", "predictor_indicators",
11-
"remove_intercept", "seed", "sil_width", "splits", "tunable", "type",
12-
"value", "x", "y"
6+
".",
7+
"..object",
8+
".cluster",
9+
".iter_config",
10+
".iter_model",
11+
".iter_preprocessor",
12+
".msg_model",
13+
".submodels",
14+
"call_info",
15+
"cluster",
16+
"component",
17+
"component_id",
18+
"compute_intercept",
19+
"data",
20+
"dist",
21+
"engine",
22+
"engine2",
23+
"exposed",
24+
"func",
25+
"id",
26+
"iteration",
27+
"lab",
28+
"name",
29+
"neighbor",
30+
"new_data",
31+
"object",
32+
"orig_label",
33+
"original",
34+
"predictor_indicators",
35+
"remove_intercept",
36+
"seed",
37+
"sil_width",
38+
"splits",
39+
"tunable",
40+
"type",
41+
"value",
42+
"x",
43+
"y"
1344
)
1445
)
1546

16-
1747
release_bullets <- function() {
1848
c(
1949
"Run `knit_engine_docs()` and `devtools::document()` to update docs"

R/append.R

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# https://github.com/tidymodels/tune/blob/main/R/pull.R#L136
2-
append_predictions <- function(collection,
3-
predictions,
4-
split,
5-
control,
6-
.config = NULL) {
2+
append_predictions <- function(
3+
collection,
4+
predictions,
5+
split,
6+
control,
7+
.config = NULL
8+
) {
79
if (!control$save_pred) {
810
return(NULL)
911
}
@@ -27,14 +29,16 @@ append_predictions <- function(collection,
2729
dplyr::bind_rows(collection, predictions)
2830
}
2931

30-
append_metrics <- function(workflow,
31-
collection,
32-
predictions,
33-
metrics,
34-
param_names,
35-
event_level,
36-
split,
37-
.config = NULL) {
32+
append_metrics <- function(
33+
workflow,
34+
collection,
35+
predictions,
36+
metrics,
37+
param_names,
38+
event_level,
39+
split,
40+
.config = NULL
41+
) {
3842
if (inherits(predictions, "try-error")) {
3943
return(collection)
4044
}
@@ -54,20 +58,22 @@ append_metrics <- function(workflow,
5458
dplyr::bind_rows(collection, tmp_est)
5559
}
5660

57-
append_extracts <- function(collection,
58-
workflow,
59-
grid,
60-
split,
61-
ctrl,
62-
.config = NULL) {
61+
append_extracts <- function(
62+
collection,
63+
workflow,
64+
grid,
65+
split,
66+
ctrl,
67+
.config = NULL
68+
) {
6369
extracts <-
6470
grid %>%
65-
dplyr::bind_cols(labels(split)) %>%
66-
dplyr::mutate(
67-
.extracts = list(
68-
extract_details(workflow, ctrl$extract)
71+
dplyr::bind_cols(labels(split)) %>%
72+
dplyr::mutate(
73+
.extracts = list(
74+
extract_details(workflow, ctrl$extract)
75+
)
6976
)
70-
)
7177

7278
if (!rlang::is_null(.config)) {
7379
extracts <- cbind(extracts, .config)

R/arguments.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ check_eng_args <- function(args, obj, core_args) {
88
if (length(common_args) > 0) {
99
args <- args[!(names(args) %in% common_args)]
1010
common_args <- paste0(common_args, collapse = ", ")
11-
rlang::warn(glue::glue(
12-
"The following arguments cannot be manually modified ",
13-
"and were removed: {common_args}."
14-
))
11+
rlang::warn(
12+
glue::glue(
13+
"The following arguments cannot be manually modified ",
14+
"and were removed: {common_args}."
15+
)
16+
)
1517
}
1618
args
1719
}
@@ -25,7 +27,8 @@ make_x_call <- function(object, target) {
2527
}
2628

2729
object$method$fit$args[[unname(data_args["x"])]] <-
28-
switch(target,
30+
switch(
31+
target,
2932
none = rlang::expr(x),
3033
data.frame = rlang::expr(maybe_data_frame(x)),
3134
matrix = rlang::expr(maybe_matrix(x)),

R/cluster_spec.R

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@
1010
#' @export
1111
#' @keywords internal
1212
new_cluster_spec <- function(cls, args, eng_args, mode, method, engine) {
13-
modelenv::check_spec_mode_engine_val(model = cls, mode = mode, eng = engine)
13+
modelenv::check_spec_mode_engine_val(
14+
model = cls,
15+
mode = mode,
16+
eng = engine,
17+
call = rlang::caller_env()
18+
)
1419

1520
out <- list(
16-
args = args, eng_args = eng_args,
17-
mode = mode, method = method, engine = engine
21+
args = args,
22+
eng_args = eng_args,
23+
mode = mode,
24+
method = method,
25+
engine = engine
1826
)
1927
class(out) <- make_classes_tidyclust(cls)
2028
out <- modelenv::new_unsupervised_spec(out)

0 commit comments

Comments
 (0)