RSiteCatalyst
RSiteCatalyst copied to clipboard
Warning message when QueueRanked run with > 1 element and no classification
trafficstars
This is quite likely a result of the fix implemented in #207, specifically methinks it's due to removing the !is.null() check.
With 1.4.11, when running QueueRanked (also QueueTrended) with more than one element, without classification, I receive the following warning:
Warning messages:
1: In is.na(elements[i, ]$classification) :
is.na() applied to non-(list or vector) of type 'NULL'
This does not impact results, from what I can tell thus far.
Example:
library(RSiteCatalyst)
SCAuth(Sys.getenv("wz_sc_id"), Sys.getenv("wz_sc_pw"))
# Baseline arglist for simplest example -----------------------------------
base_args <- list(
reportsuite.id = "elsevier-kn-prod",
date.from = Sys.Date(),
date.to = Sys.Date(),
metrics = c("pageviews", "visits"),
elements = c("evar28"),
top = c(10)
)
str(base_args)
# List of 6
# $ reportsuite.id: chr "elsevier-kn-prod"
# $ date.from : Date[1:1], format: "2017-03-07"
# $ date.to : Date[1:1], format: "2017-03-07"
# $ metrics : chr [1:2] "pageviews" "visits"
# $ elements : chr "evar28"
# $ top : num 10
# Without classification, single element ----------------------------------
base_return <- do.call(QueueRanked, base_args)
# [1] "Requesting URL attempt #1"
# [1] "Requesting URL attempt #2"
# [1] "Received ranked report."
#####################################################
# Without classification, two elements ------------------------------------
base_args_2 <- base_args
base_args_2$elements <- c("evar28", "evar75")
base_args_2$top <- c(10, 1)
str(base_args_2)
# List of 6
# $ reportsuite.id: chr "elsevier-kn-prod"
# $ date.from : Date[1:1], format: "2017-03-07"
# $ date.to : Date[1:1], format: "2017-03-07"
# $ metrics : chr [1:2] "pageviews" "visits"
# $ elements : chr [1:2] "evar28" "evar75"
# $ top : num [1:2] 10 1
base_return_2 <- do.call(QueueRanked, base_args_2)
# [1] "Requesting URL attempt #1"
# [1] "Requesting URL attempt #2"
# [1] "Received ranked report."
# There were 20 warnings (use warnings() to see them)
# Warning messages:
# 1: In is.na(elements[i, ]$classification) :
# is.na() applied to non-(list or vector) of type 'NULL'
#####################################################
# With classification, single element -------------------------------------
base_with_class <- base_args
base_with_class$classification = "Subject Areas [v28]"
str(base_with_class)
# List of 7
# $ reportsuite.id: chr "elsevier-kn-prod"
# $ date.from : Date[1:1], format: "2017-03-07"
# $ date.to : Date[1:1], format: "2017-03-07"
# $ metrics : chr [1:2] "pageviews" "visits"
# $ elements : chr "evar28"
# $ top : num 10
# $ classification: chr "Subject Areas [v28]"
base_with_class_return <- do.call(QueueRanked, base_with_class)
# [1] "Requesting URL attempt #1"
# [1] "Requesting URL attempt #2"
# [1] "Received ranked report."
# With classification, two elements ---------------------------------------
base_with_class_2 <- base_args_2
base_with_class_2$classification = "Subject Areas [v28]"
str(base_with_class_2)
# List of 7
# $ reportsuite.id: chr "elsevier-kn-prod"
# $ date.from : Date[1:1], format: "2017-03-07"
# $ date.to : Date[1:1], format: "2017-03-07"
# $ metrics : chr [1:2] "pageviews" "visits"
# $ elements : chr [1:2] "evar28" "evar75"
# $ top : num [1:2] 10 1
# $ classification: chr "Subject Areas [v28]"
base_with_class_return_2 <- do.call(QueueRanked, base_with_class_2)
# [1] "Requesting URL attempt #1"
# [1] "Requesting URL attempt #2"
# [1] "Requesting URL attempt #3"
# [1] "Received ranked report."
Session info:
devtools::session_info()
Session Info ------------------------------------------------------------
setting value
version R version 3.3.2 (2016-10-31)
system x86_64, mingw32
ui RStudio (1.0.44)
language (EN)
collate English_United States.1252
tz America/New_York
date 2017-03-07
Packages ----------------------------------------------------------------
package * version date source
base64enc 0.1-3 2015-07-28 CRAN (R 3.3.0)
curl 2.3 2016-11-24 CRAN (R 3.3.2)
devtools 1.12.0 2016-06-24 CRAN (R 3.3.2)
digest 0.6.10 2016-08-02 CRAN (R 3.3.1)
httr 1.2.1 2016-07-03 CRAN (R 3.3.1)
jsonlite 1.3 2017-02-28 CRAN (R 3.3.2)
magrittr 1.5 2014-11-22 CRAN (R 3.3.0)
memoise 1.0.0 2016-01-29 CRAN (R 3.3.0)
plyr 1.8.4 2016-06-08 CRAN (R 3.3.1)
R6 2.2.0 2016-10-05 CRAN (R 3.3.2)
Rcpp 0.12.8 2016-11-17 CRAN (R 3.3.2)
RSiteCatalyst * 1.4.11 2017-03-04 CRAN (R 3.3.2)
stringi 1.1.2 2016-10-01 CRAN (R 3.3.2)
stringr 1.2.0 2017-02-18 CRAN (R 3.3.2)
withr 1.0.2 2016-06-20 CRAN (R 3.3.1)
Thanks. I actually left all 3 checks in:
https://github.com/randyzwitch/RSiteCatalyst/blob/master/R/BuildInnerBreakdownsRecursively.R#L86
And, I hate missingness :(
Right, sorry-- missed that. Perhaps the order of the checks, then?
Agreed on missingness.