Skip to content

Commit a8ea024

Browse files
committed
fixes for R CMD check
1 parent bba99ef commit a8ea024

5 files changed

Lines changed: 15 additions & 4 deletions

File tree

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import(ggplot2)
2929
import(httr)
3030
import(jsonlite)
3131
importFrom(base64enc,base64encode)
32+
importFrom(grDevices,col2rgb)
3233
importFrom(htmlwidgets,createWidget)
3334
importFrom(htmlwidgets,shinyRenderWidget)
3435
importFrom(htmlwidgets,shinyWidgetOutput)
@@ -37,4 +38,6 @@ importFrom(magrittr,"%>%")
3738
importFrom(plyr,ddply)
3839
importFrom(plyr,join)
3940
importFrom(plyr,summarise)
41+
importFrom(utils,getFromNamespace)
42+
importFrom(utils,modifyList)
4043
importFrom(viridis,viridis)

R/print.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ print.plotly <- function(x, ...) {
2424
#' @param height attribute of the iframe
2525
#' @export
2626
embed_notebook <- function(x, width = "100%", height = "525") {
27-
if (!requireNamespace("IRdisplay")) {
27+
if (system.file(package = "IRdisplay") == "") {
2828
warning("You need the IRdisplay package to use this function: \n",
2929
"devtools::install_github(c('IRkernel/repr', 'IRKernel/IRdisplay'))")
3030
return(x)

R/utils.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#' @importFrom grDevices col2rgb
2+
#' @importFrom utils getFromNamespace modifyList
3+
14
is.plotly <- function(x) inherits(x, "plotly")
25

36
"%||%" <- function(x, y) {
@@ -6,7 +9,7 @@ is.plotly <- function(x) inherits(x, "plotly")
69

710
# this function is called after the package is loaded
811
.onAttach <- function(...) {
9-
usr <- verify("username")
12+
usr <- verify("username", warn = FALSE)
1013
if (nchar(usr) > 0) packageStartupMessage("\n", "Howdy, ", usr, "!")
1114
invisible(NULL)
1215
}
@@ -66,9 +69,9 @@ last_plot <- function(data = NULL) {
6669
}
6770

6871
# Check for credentials/configuration and throw warnings where appropriate
69-
verify <- function(what = "username") {
72+
verify <- function(what = "username", warn = TRUE) {
7073
val <- grab(what)
71-
if (val == "") {
74+
if (val == "" && warn) {
7275
switch(what,
7376
username = warning("You need a plotly username. See help(signup, package = 'plotly')", call. = FALSE),
7477
api_key = warning("You need an api_key. See help(signup, package = 'plotly')", call. = FALSE))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
context("Filename")
22

33
test_that("filepath with directories is returned as passed", {
4+
skip_on_cran()
45
p <- plot_ly(mtcars, x = wt, y = vs, filename = "directory/awesome")
56
expect_match(plotly_POST(p)$filename, "directory/awesome")
67
})

tests/testthat/test-plotly-getfigure.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
context("get_figure")
22

33
test_that("requests made by a user who doesn't exist error a 404", {
4+
skip_on_cran()
45
expect_error({
56
get_figure("klmadslfjdfljdsf", 0)
67
}, ".*404.*")
78
})
89

910
test_that("requests made to retrieve a figure that doesn't exist returns a 404", {
11+
skip_on_cran()
1012
expect_error({
1113
get_figure("get_test_user", 18324823)
1214
}, ".*404.*")
1315
})
1416

1517
test_that("requests made to retrieve some elses private file errors a 403", {
18+
skip_on_cran()
1619
expect_error({
1720
get_figure("get_test_user", 1)
1821
}, ".*403.*")
1922
})
2023

2124
test_that("retrieving a public figure ... works.", {
25+
skip_on_cran()
2226
fig <- get_figure("get_test_user", 0)
2327
# get the data behind the hash
2428
p <- plotly_build(fig)

0 commit comments

Comments
 (0)