@@ -99,7 +99,7 @@ There are some packages that are used by both, "wasserportal" and "kwb.dwd".
99
99
kwb.package::cranVersions("magrittr")
100
100
```
101
101
102
- ### Which versions of R packages on GitHub exist ?
102
+ ### What R package versions exist on our GitHub account "KWB-R" ?
103
103
104
104
``` {r}
105
105
kwb.package::githubVersions(name = "kwb.utils")
@@ -124,3 +124,48 @@ corresponding tag defined in the GitHub repo as in the following example:
124
124
``` {r}
125
125
kwb.package::downloadGitHubPackage("kwb-r/[email protected] ")
126
126
```
127
+
128
+ ### Which of our R packages on GitHub are on R-Universe?
129
+
130
+ Thanks to Michael Rustler our R packages that are published on our
131
+ GitHub account (https://github.com/kwb-r ) are also made available on a
132
+ CRAN-like repository called an "R-universe" (https://kwb-r.r-universe.dev ).
133
+
134
+ The packages on GitHub can be installed with ` remotes::install_github() ` ,
135
+ whereas the R-universe packages can be installed with the base R command
136
+ ` install.packages() ` given that the path to the corresponding repo is either
137
+ set in ` options("repos") ` or explicitly given, such as in:
138
+
139
+ ```
140
+ install.packages("kwb.utils", repos = "https://kwb-r.r-universe.dev")
141
+ ```
142
+ I wonder how to check if all packages that are on GitHub are also available
143
+ in our R-universe. This is the way to go:
144
+
145
+ ``` {r eval = TRUE}
146
+ # Provide magrittr's pipe operator
147
+ `%>%` <- magrittr::`%>%`
148
+
149
+ # Get database of packages that are available on our GitHub account
150
+ github_package_db <- kwb.utils:::get_cached("github_package_db")
151
+
152
+ if (is.null(github_package_db)) {
153
+ github_package_db <- kwb.pkgstatus::make_github_package_db() %>%
154
+ kwb.utils:::cache_and_return(name = "github_package_db")
155
+ }
156
+
157
+ # Get database of packages that are available in our R-universe
158
+ universe_package_db <- "https://kwb-r.r-universe.dev" %>%
159
+ contrib.url(type = "both") %>%
160
+ available.packages() %>%
161
+ as.data.frame(row.names = NULL)
162
+
163
+ # What packages are only on KWB-R on GitHub but not on R-universe?
164
+ github_packages <- github_package_db$Package
165
+ universe_packages <- universe_package_db$Package
166
+
167
+ github_package_db[!github_packages %in% universe_packages, c(1L, 3L, 6L)]
168
+
169
+ # Are there packages on R-universe that are not on GitHub?
170
+ universe_package_db[!universe_packages %in% github_packages, 1:3]
171
+ ```
0 commit comments