Skip to content

Commit 11999e9

Browse files
authored
Merge pull request #72 from mountainMath/disable-examples-vignettes
disable running of examples and vignettes using web services during CRAN check
2 parents 021e3af + ef650d9 commit 11999e9

86 files changed

Lines changed: 644 additions & 358 deletions

File tree

Some content is hidden

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

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: cansim
22
Type: Package
33
Title: Accessing Statistics Canada Data Table and Vectors
4-
Version: 0.3.4
4+
Version: 0.3.5
55
Authors@R: c(
66
person("Jens", "von Bergmann", email = "jens@mountainmath.ca", role = c("cre")),
77
person("Dmitry", "Shkolnik", email = "shkolnikd@gmail.com", role = c("aut")))
@@ -25,7 +25,7 @@ Imports: dplyr (>= 0.7),
2525
tibble,
2626
utils,
2727
jsonlite
28-
RoxygenNote: 7.0.2
28+
RoxygenNote: 7.1.0
2929
Suggests: knitr,
3030
rmarkdown,
3131
scales,

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## cansim 0.3.5
2+
### Minor changes
3+
- Exclude all vignettes and example code from compilation as this may cause CRAN check errors when StatCan servers are down or otherwise temporarily unavailable
4+
5+
16
## cansim 0.3.4
27

38
### Minor changes

R/cansim.R

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
#' @return tibble format data table output
1313
#'
1414
#' @examples
15+
#' \donttest{
1516
#' # Retrieve a table with an NDM code
1617
#' get_cansim("34-10-0013")
1718
#' # Retrieve a table with an old-style CANSIM code
1819
#' get_cansim("026-0018")
19-
#'
20+
#' }
2021
#' @export
2122
get_cansim <- function(cansimTableNumber, language="english", refresh=FALSE, timeout = 200){
2223
get_cansim_ndm(cleaned_ndm_table_number(cansimTableNumber), language, refresh, timeout = timeout)
@@ -50,9 +51,10 @@ adjust_cansim_values_by_variable <-function(data, var){
5051
#' @return Returns the input tibble with with adjusted values
5152
#'
5253
#' @examples
54+
#' \donttest{
5355
#' cansim_table <- get_cansim("34-10-0013")
5456
#' normalize_cansim_values(cansim_table)
55-
#'
57+
#' }
5658
#' @export
5759
normalize_cansim_values <- function(data, replacement_value=NA, normalize_percent=TRUE, default_month="01", default_day="01",factors=FALSE,strip_classification_code=FALSE){
5860
language <- ifelse("VALEUR" %in% names(data),"fr","en")
@@ -136,8 +138,9 @@ normalize_cansim_values <- function(data, replacement_value=NA, normalize_percen
136138
#' @return new-format NDM table number
137139
#'
138140
#' @examples
141+
#' \donttest{
139142
#' cansim_old_to_new("026-0018")
140-
#'
143+
#' }
141144
#' @export
142145
cansim_old_to_new <- function(oldCansimTableNumber){
143146
# cache the file as data, old table numbers should not change
@@ -304,8 +307,9 @@ parse_and_fold_in_metadata <- function(data,meta,data_path){
304307
#' @return tibble format data table output
305308
#'
306309
#' @examples
310+
#' \donttest{
307311
#' get_cansim("34-10-0013")
308-
#'
312+
#' }
309313
#' @export
310314
get_cansim_ndm <- function(cansimTableNumber, language="english", refresh=FALSE,timeout=200){
311315
cleaned_number <- cleaned_ndm_table_number(cansimTableNumber)
@@ -375,8 +379,9 @@ get_cansim_ndm <- function(cansimTableNumber, language="english", refresh=FALSE,
375379
# Set to higher values for large tables and slow network connection. (Default is \code{200}).
376380
#'
377381
#' @examples
382+
#' \donttest{
378383
#' get_cansim_table_info("34-10-0013")
379-
#'
384+
#' }
380385
#' @export
381386
get_cansim_table_info <- function(cansimTableNumber, language="english", refresh=FALSE, timeout=200){
382387
data_path <- paste0(base_path_for_table_language(cansimTableNumber,language),".Rda1")
@@ -398,8 +403,9 @@ get_cansim_table_info <- function(cansimTableNumber, language="english", refresh
398403
# Set to higher values for large tables and slow network connection. (Default is \code{200}).
399404
#'
400405
#' @examples
406+
#' \donttest{
401407
#' get_cansim_table_survey("34-10-0013")
402-
#'
408+
#' }
403409
#' @export
404410
get_cansim_table_survey <- function(cansimTableNumber, language="english", refresh=FALSE, timeout=200){
405411
data_path <- paste0(base_path_for_table_language(cansimTableNumber,language),".Rda3")
@@ -420,8 +426,9 @@ get_cansim_table_survey <- function(cansimTableNumber, language="english", refre
420426
# Set to higher values for large tables and slow network connection. (Default is \code{200}).
421427
#'
422428
#' @examples
429+
#' \donttest{
423430
#' get_cansim_table_subject("34-10-0013")
424-
#'
431+
#' }
425432
#' @export
426433
get_cansim_table_subject <- function(cansimTableNumber, language="english", refresh=FALSE, timeout = 200){
427434
data_path <- paste0(base_path_for_table_language(cansimTableNumber,language),".Rda4")
@@ -442,8 +449,9 @@ get_cansim_table_subject <- function(cansimTableNumber, language="english", refr
442449
# Set to higher values for large tables and slow network connection. (Default is \code{200}).
443450
#'
444451
#' @examples
452+
#' \donttest{
445453
#' get_cansim_table_short_notes("34-10-0013")
446-
#'
454+
#' }
447455
#' @export
448456
get_cansim_table_short_notes <- function(cansimTableNumber, language="english", refresh=FALSE, timeout = 200){
449457
data_path <- paste0(base_path_for_table_language(cansimTableNumber,language),".Rda5")
@@ -464,8 +472,9 @@ get_cansim_table_short_notes <- function(cansimTableNumber, language="english",
464472
# Set to higher values for large tables and slow network connection. (Default is \code{200}).
465473
#'
466474
#' @examples
475+
#' \donttest{
467476
#' get_cansim_column_list("34-10-0013")
468-
#'
477+
#' }
469478
#' @export
470479
get_cansim_column_list <- function(cansimTableNumber, language="english", refresh=FALSE, timeout= 200){
471480
data_path <- paste0(base_path_for_table_language(cansimTableNumber,language),".Rda2")
@@ -487,8 +496,9 @@ get_cansim_column_list <- function(cansimTableNumber, language="english", refres
487496
# Set to higher values for large tables and slow network connection. (Default is \code{200}).
488497
#'
489498
#' @examples
499+
#' \donttest{
490500
#' get_cansim_column_categories("34-10-0013", "Geography")
491-
#'
501+
#' }
492502
#' @export
493503
get_cansim_column_categories <- function(cansimTableNumber, column, language="english", refresh=FALSE, timeout = 200){
494504
data_path <- paste0(base_path_for_table_language(cansimTableNumber,language),".Rda2")
@@ -513,8 +523,9 @@ get_cansim_column_categories <- function(cansimTableNumber, column, language="en
513523
#' @return none
514524
#'
515525
#' @examples
526+
#' \donttest{
516527
#' get_cansim_table_overview("34-10-0013")
517-
#'
528+
#' }
518529
#' @export
519530
get_cansim_table_overview <- function(cansimTableNumber, language="english", refresh=FALSE){
520531
cansimTableNumber <- cleaned_ndm_table_number(cansimTableNumber)
@@ -556,6 +567,11 @@ get_cansim_table_overview <- function(cansimTableNumber, language="english", ref
556567
#'
557568
#' @return A vector of categories
558569
#'
570+
#' @examples
571+
#' \donttest{
572+
#' data <- get_cansim("16-10-0117")
573+
#' categories_for_level(data,"North American Industry Classification System (NAICS)",level=2)
574+
#' }
559575
#' @export
560576
categories_for_level <- function(data,column_name, level=NA, strict=FALSE, remove_duplicates=TRUE){
561577
hierarchy_name=paste0("Hierarchy for ",column_name)
@@ -645,6 +661,10 @@ generate_table_metadata <- function(){
645661
#'
646662
#' @return none
647663
#'
664+
#' @examples
665+
#' \donttest{
666+
#' view_cansim_webpage("34-10-0013")
667+
#' }
648668
#' @export
649669
view_cansim_webpage <- function(cansimTableNumber){
650670
browser <- getOption("browser")
@@ -662,8 +682,9 @@ view_cansim_webpage <- function(cansimTableNumber){
662682
#' @return a tibble containing the table metadata
663683
#'
664684
#' @examples
685+
#' \donttest{
665686
#' get_cansim_cube_metadata("34-10-0013")
666-
#'
687+
#' }
667688
#' @export
668689
get_cansim_cube_metadata <- function(cansimTableNumber){
669690
table_id=naked_ndm_table_number(cansimTableNumber)
@@ -712,9 +733,10 @@ get_cansim_cube_metadata <- function(cansimTableNumber){
712733
#' @return String object containing URL for specified table number
713734
#'
714735
#' @examples
736+
#' \donttest{
715737
#' get_cansim_table_url("34-10-0013")
716738
#' get_cansim_table_url("34-10-0013", language = "fr")
717-
#'
739+
#' }
718740
#' @export
719741
get_cansim_table_url <- function(cansimTableNumber, language = "en"){
720742
l <- cleaned_ndm_language(language) %>% substr(1,2)
@@ -735,8 +757,9 @@ get_cansim_table_url <- function(cansimTableNumber, language = "en"){
735757
#' @return A tibble with Statistics Canada data table product ids and their release times
736758
#'
737759
#' @examples
760+
#' \donttest{
738761
#' get_cansim_changed_tables("2018-08-01")
739-
#'
762+
#' }
740763
#' @export
741764
get_cansim_changed_tables <- function(start_date){
742765
end_date=NA
@@ -763,8 +786,9 @@ get_cansim_changed_tables <- function(start_date){
763786
# Set to higher values for large tables and slow network connection. (Default is \code{200}).
764787
#'
765788
#' @examples
789+
#' \donttest{
766790
#' get_cansim_table_notes("34-10-0013")
767-
#'
791+
#' }
768792
#' @export
769793
get_cansim_table_notes <- function(cansimTableNumber,language="en",refresh=FALSE, timeout = 200) {
770794
cleaned_language <- cleaned_ndm_language(language)

R/cansim_helpers.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ short_prov.fr <- purrr::set_names(c(
177177
#' @return a code{cansim} package data frame with additional factor GEO.abb that contains language-specific provincial abbreviations
178178
#'
179179
#' @examples
180-
#' \dontrun{
180+
#' \donttest{
181181
#' df <- get_cansim("17-10-0005")
182182
#' df <- add_provincial_abbreviations(df)
183183
#' }
@@ -206,8 +206,9 @@ add_provincial_abbreviations <- function(data){
206206
#' @return a tibble with english and french labels for the given code set
207207
#'
208208
#' @examples
209+
#' \donttest{
209210
#' get_cansim_code_set("survey")
210-
#'
211+
#' }
211212
get_cansim_code_set <- function(code_set=c("scalar", "frequency", "symbol", "status", "uom", "survey", "subject", "wdsResponseStatus"),
212213
refresh=FALSE){
213214
code_sets <- c("scalar", "frequency", "symbol", "status", "uom", "survey", "subject", "wdsResponseStatus")

R/cansim_tables_list.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ get_cansim_table_list_page <- function(start_offset=0,max_rows=1000){
102102
#' @return A tibble with available Statistics Canada data tables, listing title, Statistics Canada data table catalogue number, deprecated CANSIM table number, description, and geography
103103
#'
104104
#' @examples
105+
#'
105106
#' list_cansim_tables()
106107
#'
107108
#' @export
@@ -151,6 +152,7 @@ list_cansim_tables <- function(refresh=FALSE){
151152
#' @return A tibble with available Statistics Canada data tables, listing title, Statistics Canada data table catalogue number, deprecated CANSIM table number, description and geography that match the search term.
152153
#'
153154
#' @examples
155+
#'
154156
#' search_cansim_tables("Labour force")
155157
#'
156158
#' @export
@@ -181,7 +183,7 @@ search_cansim_tables <- function(search_term, search_fields = "both", refresh=FA
181183
#' start and end dates, achieve status, subject and survey codes, frequency codes and a list of cube dimensions.
182184
#'
183185
#' @examples
184-
#' \dontrun{
186+
#' \donttest{
185187
#' list_cansim_cubes()
186188
#' }
187189
#'
@@ -260,7 +262,7 @@ list_cansim_cubes <- function(lite=FALSE,refresh=FALSE){
260262
#' @return A tibble with available Statistics Canada data cubes, listing title, Statistics Canada data cube catalogue number, deprecated CANSIM table number, survey and subject.
261263
#'
262264
#' @examples
263-
#' \dontrun{
265+
#' \donttest{
264266
#' search_cansim_cubes("Labour force")
265267
#' }
266268
#'

R/cansim_vectors.R

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ rename_vectors <- function(data,vectors){
7777
#' @return A tibble with data for vectors released between start and end time
7878
#'
7979
#' @examples
80+
#' \donttest{
8081
#' get_cansim_vector("v41690973","2015-01-01")
81-
#'
82+
#' }
8283
#' @export
8384
get_cansim_vector<-function(vectors, start_time, end_time=Sys.time(), use_ref_date=TRUE){
8485
start_time=as.Date(start_time)
@@ -125,8 +126,9 @@ get_cansim_vector<-function(vectors, start_time, end_time=Sys.time(), use_ref_da
125126
#' @return A tibble with data for specified vector(s) for the last N periods
126127
#'
127128
#' @examples
129+
#' \donttest{
128130
#' get_cansim_vector_for_latest_periods("v41690973",10)
129-
#'
131+
#' }
130132
#' @export
131133
get_cansim_vector_for_latest_periods<-function(vectors, periods=1){
132134
if (periods*length(vectors)>MAX_PERIODS) {
@@ -169,6 +171,10 @@ get_cansim_vector_for_latest_periods<-function(vectors, periods=1){
169171
#'
170172
#' @return A tibble with data matching specified coordinate and period input arguments
171173
#'
174+
#' @examples
175+
#' \donttest{
176+
#' get_cansim_data_for_table_coord_periods("35-10-0003",coordinate="1.12.0.0.0.0.0.0.0.0",periods=3)
177+
#' }
172178
#' @export
173179
get_cansim_data_for_table_coord_periods<-function(cansimTableNumber, coordinate, periods=1){
174180
table=naked_ndm_table_number(cansimTableNumber)
@@ -200,6 +206,10 @@ get_cansim_data_for_table_coord_periods<-function(cansimTableNumber, coordinate,
200206
#'
201207
#' @return A tibble with metadata for selected vectors
202208
#'
209+
#' @examples
210+
#' \donttest{
211+
#' get_cansim_vector_info("v41690973")
212+
#' }
203213
#' @export
204214
get_cansim_vector_info <- function(vectors){
205215
vectors=gsub("^v","",vectors) # allow for leading "v" by conditionally stripping it

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,15 @@ If you want to get in touch, we are pretty good at responding via email or via t
180180

181181
If you wish to cite the `cansim` package in your work:
182182

183-
von Bergmann, J., Dmitry Shkolnik (2020). cansim: functions and convenience tools for accessing Statistics Canada data tables. v0.3.4.
183+
von Bergmann, J., Dmitry Shkolnik (2020). cansim: functions and convenience tools for accessing Statistics Canada data tables. v0.3.5.
184184

185185
A BibTeX entry for LaTeX users is
186186
```
187187
@Manual{,
188188
author = {Jens {von Bergmann} and Dmitry Shkolnik},
189189
title = {cansim: functions and convenience tools for accessing Statistics Canada data tables},
190190
year = {2020},
191-
note = {R package version 0.3.4},
191+
note = {R package version 0.3.5},
192192
url = {https://mountainmath.github.io/cansim/},
193193
}
194194
```

cran-comments.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ There were no ERRORs or WARNINGs or NOTEs.
3838
* Expand get_cansim_table_notes functionality
3939
* Add functionality to access the new cube list API
4040

41+
## Changes from version 0.3.4
42+
43+
* Exclude all vignettes and example code from compilation as this may cause CRAN check errors when StatCan servers are down or otherwise temporarily unavailable
44+
45+

docs/404.html

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

docs/LICENSE-text.html

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

0 commit comments

Comments
 (0)