Skip to content

Commit 9a14b1d

Browse files
authored
Merge pull request #30 from tidymodels/no-right-join
Remove right join from k-means
2 parents d98a581 + 7c64c6d commit 9a14b1d

File tree

8 files changed

+33
-21
lines changed

8 files changed

+33
-21
lines changed

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
on: [push, pull_request]
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- master
28

39
name: R-CMD-check
410

@@ -13,13 +19,13 @@ jobs:
1319
matrix:
1420
config:
1521
- {os: macOS-latest, r: 'devel'}
16-
- {os: macOS-latest, r: '4.0'}
17-
- {os: windows-latest, r: '4.0'}
18-
- {os: ubuntu-16.04, r: '4.0', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
19-
- {os: ubuntu-16.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
20-
- {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
21-
- {os: ubuntu-16.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
22-
- {os: ubuntu-16.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
22+
- {os: macOS-latest, r: 'release'}
23+
- {os: windows-latest, r: 'release'}
24+
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
25+
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
26+
- {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
27+
- {os: ubuntu-16.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
28+
- {os: ubuntu-16.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
2329

2430
env:
2531
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
@@ -39,15 +45,16 @@ jobs:
3945
run: |
4046
install.packages('remotes')
4147
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
48+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
4249
shell: Rscript {0}
4350

4451
- name: Cache R packages
4552
if: runner.os != 'Windows'
4653
uses: actions/cache@v1
4754
with:
4855
path: ${{ env.R_LIBS_USER }}
49-
key: ${{ runner.os }}-r-${{ matrix.config.r }}-1-${{ hashFiles('.github/depends.Rds') }}
50-
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-1-
56+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
57+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
5158

5259
- name: Install system dependencies
5360
if: runner.os == 'Linux'

.github/workflows/pkgdown.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ jobs:
2020
run: |
2121
install.packages('remotes')
2222
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
23+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
2324
shell: Rscript {0}
2425

2526
- name: Cache R packages
2627
uses: actions/cache@v1
2728
with:
2829
path: ${{ env.R_LIBS_USER }}
29-
key: macOS-r-4.0-1-${{ hashFiles('.github/depends.Rds') }}
30-
restore-keys: macOS-r-4.0-1-
30+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
31+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
3132

3233
- name: Install dependencies
3334
run: |

.github/workflows/test-coverage.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ jobs:
2424
run: |
2525
install.packages('remotes')
2626
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
27+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
2728
shell: Rscript {0}
2829

2930
- name: Cache R packages
3031
uses: actions/cache@v1
3132
with:
3233
path: ${{ env.R_LIBS_USER }}
33-
key: macOS-r-4.0-1-${{ hashFiles('.github/depends.Rds') }}
34-
restore-keys: macOS-r-4.0-1-
34+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
35+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
3536

3637
- name: Install dependencies
3738
run: |

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ Suggests:
2727
License: GPL-3
2828
URL: https://modeldb.tidymodels.org, https://github.com/tidymodels/modeldb
2929
BugReports: https://github.com/tidymodels/modeldb/issues
30-
RoxygenNote: 7.0.2
30+
RoxygenNote: 7.1.0.9000
3131
Encoding: UTF-8
3232
VignetteBuilder: knitr

NAMESPACE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@ importFrom(dplyr,bind_cols)
1717
importFrom(dplyr,case_when)
1818
importFrom(dplyr,collect)
1919
importFrom(dplyr,contains)
20+
importFrom(dplyr,everything)
2021
importFrom(dplyr,filter)
2122
importFrom(dplyr,filter_all)
2223
importFrom(dplyr,funs)
2324
importFrom(dplyr,group_by)
2425
importFrom(dplyr,group_vars)
2526
importFrom(dplyr,lag)
27+
importFrom(dplyr,left_join)
2628
importFrom(dplyr,mutate)
2729
importFrom(dplyr,n)
2830
importFrom(dplyr,pull)
2931
importFrom(dplyr,rename)
3032
importFrom(dplyr,rename_all)
31-
importFrom(dplyr,right_join)
3233
importFrom(dplyr,select)
3334
importFrom(dplyr,summarise)
3435
importFrom(dplyr,summarise_all)

R/kmeans.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,12 @@ simple_kmeans_db <- function(df,
8787
if (all(prev_centroids == centroids)) break()
8888
}
8989
centroids_db <- rename_all(centroids_db, ~paste0("k_", .))
90-
right_join(
90+
joined <- left_join(
91+
rename(new_centroids, k_center = center),
9192
centroids_db,
92-
new_centroids,
93-
by = c("k_center" = "center")
93+
by = "k_center"
9494
)
95+
select(joined, contains("k_"), everything())
9596
}
9697

9798
calculate_centers <- function(df, center_df, centers, vars) {

R/modeldb.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#' @import rlang
22
#' @import ggplot2
33
#' @import tibble
4-
#' @importFrom dplyr mutate summarise right_join
4+
#' @importFrom dplyr mutate summarise left_join
55
#' @importFrom dplyr summarise_all filter_all
66
#' @importFrom dplyr pull collect arrange
77
#' @importFrom dplyr contains tally ungroup
88
#' @importFrom dplyr group_vars lag bind_cols
99
#' @importFrom dplyr all_vars group_by funs
1010
#' @importFrom dplyr n as_tibble filter select
1111
#' @importFrom dplyr case_when rename rename_all
12-
#' @importFrom dplyr tbl_vars
12+
#' @importFrom dplyr tbl_vars everything
1313
#' @importFrom purrr map map2 map_df transpose
1414
#' @importFrom purrr reduce imap pluck
1515
#' @importFrom tidypredict as_parsed_model

man/modeldb-package.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)