Unverified Commit c454d5f8 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] move all examples to dontrun() to fix R CMD CHECK notes (#3270)



* Move all examples to dontrun

* update docs

* fix nested dontrun

* remove :: in examples

* run_dontrun in pkgdown
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
parent 6f54ec3d
...@@ -18,7 +18,7 @@ readRDS.lgb.Booster(file = "", refhook = NULL) ...@@ -18,7 +18,7 @@ readRDS.lgb.Booster(file = "", refhook = NULL)
Attempts to load a model stored in a \code{.rds} file, using \code{\link[base]{readRDS}} Attempts to load a model stored in a \code{.rds} file, using \code{\link[base]{readRDS}}
} }
\examples{ \examples{
\donttest{ \dontrun{
library(lightgbm) library(lightgbm)
data(agaricus.train, package = "lightgbm") data(agaricus.train, package = "lightgbm")
train <- agaricus.train train <- agaricus.train
......
...@@ -42,7 +42,7 @@ Attempts to save a model using RDS. Has an additional parameter (\code{raw}) ...@@ -42,7 +42,7 @@ Attempts to save a model using RDS. Has an additional parameter (\code{raw})
which decides whether to save the raw model or not. which decides whether to save the raw model or not.
} }
\examples{ \examples{
\donttest{ \dontrun{
library(lightgbm) library(lightgbm)
data(agaricus.train, package = "lightgbm") data(agaricus.train, package = "lightgbm")
train <- agaricus.train train <- agaricus.train
......
...@@ -38,6 +38,7 @@ The \code{name} field can be one of the following: ...@@ -38,6 +38,7 @@ The \code{name} field can be one of the following:
} }
} }
\examples{ \examples{
\dontrun{
data(agaricus.train, package = "lightgbm") data(agaricus.train, package = "lightgbm")
train <- agaricus.train train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label) dtrain <- lgb.Dataset(train$data, label = train$label)
...@@ -48,5 +49,5 @@ lightgbm::setinfo(dtrain, "label", 1 - labels) ...@@ -48,5 +49,5 @@ lightgbm::setinfo(dtrain, "label", 1 - labels)
labels2 <- lightgbm::getinfo(dtrain, "label") labels2 <- lightgbm::getinfo(dtrain, "label")
stopifnot(all.equal(labels2, 1 - labels)) stopifnot(all.equal(labels2, 1 - labels))
}
} }
...@@ -24,6 +24,7 @@ Get a new \code{lgb.Dataset} containing the specified rows of ...@@ -24,6 +24,7 @@ Get a new \code{lgb.Dataset} containing the specified rows of
original \code{lgb.Dataset} object original \code{lgb.Dataset} object
} }
\examples{ \examples{
\dontrun{
data(agaricus.train, package = "lightgbm") data(agaricus.train, package = "lightgbm")
train <- agaricus.train train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label) dtrain <- lgb.Dataset(train$data, label = train$label)
...@@ -31,5 +32,5 @@ dtrain <- lgb.Dataset(train$data, label = train$label) ...@@ -31,5 +32,5 @@ dtrain <- lgb.Dataset(train$data, label = train$label)
dsub <- lightgbm::slice(dtrain, seq_len(42L)) dsub <- lightgbm::slice(dtrain, seq_len(42L))
lgb.Dataset.construct(dsub) lgb.Dataset.construct(dsub)
labels <- lightgbm::getinfo(dsub, "label") labels <- lightgbm::getinfo(dsub, "label")
}
} }
...@@ -247,7 +247,7 @@ def generate_r_docs(app): ...@@ -247,7 +247,7 @@ def generate_r_docs(app):
, install = FALSE \ , install = FALSE \
, devel = FALSE \ , devel = FALSE \
, examples = TRUE \ , examples = TRUE \
, run_dont_run = FALSE \ , run_dont_run = TRUE \
, seed = 42L \ , seed = 42L \
, preview = FALSE \ , preview = FALSE \
, new_process = TRUE \ , new_process = TRUE \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment