Devtools::check error



I am new to the Studio Community and developing a R Package using devtools and roxygen2. I have purchased Hadley Wikham’s book “R Packages” and have made every attempt to address problems searching the web for answers.

Please excuse me if I have not provided enough information with my abridged problem description. I have several concerns but I am limiting it to two questions:

Question 1: How to remove ‘lst’ when rm(lst) does not work?

Here is the scenario: ‘lst’ appears in the Global Environment under Data. It also is listed under package:carfollow under Data. It appears to me that it is a hidden object that the rm function cannot reach the ‘rm’ command.

Question 2: ‘lead’ is available. It is listed as a global environment variable.

f1(lead, cfmat, t)
Error in f1(lead, cfmat, t) : object ‘lead’ not found
Execution halted

==> devtools::check()

── 1 error :heavy_multiplication_x: | 2 warnings :heavy_multiplication_x: | 1 note :heavy_multiplication_x:

R CMD check succeeded

W checking for missing documentation entries
Undocumented code objects:
All user-level objects in a package should have documentation entries.

[1] “.GlobalEnv” “package:carfollow” “devtools_shims” “package:usethis” “package:devtools”
[6] “tools:rstudio” “package:stats” “package:graphics” “package:grDevices” “package:utils”
[11] “package:datasets” “package:methods” “Autoloads” “package:base”

E checking examples
Running examples in ‘carfollow-Ex.R’ failed
The error most likely occurred in:

base::assign(".ptime", proc.time(), pos = “CheckExEnv”)

Name: f1

Title: Headway ‘h’ between the lead and following vehicles at time ‘t’.

Lead and following vehicles use gBm and constant speed models,


Aliases: f1

─ > ### ** Examples

f1(lead, cfmat, t)
Error in f1(lead, cfmat, t) : object ‘lead’ not found
Execution halted



Concerning 1.: Is “carfollow” the name of your package ? If so, and “lst” is a dataset exported by it (i.e., you have a “lst.rda” file in your data folder), then it should be documented in a Rd file as if it was a function, otherwise you’ll get a warning while checking the package. You can find instructions about how documenting datasets here :

Concerning 2: consider that when you check the package the examples are run in a “clean envirnoment”. Therefore, even if you have a variable named “lead” available in your current R session, the example will not be able to access it (I hope I’m not wrong on this :thinking: ). If you want to prevent the error, you will have to either create the variables needed to run f1(lead, cfmat, t) within the example (or load them from somewhere), or include the example in a \dontrun{ } block. (see




This is a test

I cannot reply.


“Sorry, new users can only mention 2 users in a post.”

I cannot figure out what this means.

I cannot reply.


Thanks for the help. “Check” did not like vectors or matrices being passed to my function. I entered 13 variables to my function. It passes devtools::check() with note: “Non-standard file/directory found at top level: ‘plot.pdf’”. “Check” fails. Error in “package build.” I have no idea how to remove the note or fix the failure. Passing 13 variables is awkward at best.



What do you mean by

““Check” did not like vectors or matrices being passed to my function”

? You can pass whatever you want to a function. I think that if you appear to have solved a build error by “splitting” the arguments, you probably changed something else that actually solved the problem.

Besides this, the note "Non-standard file/directory found at top level: ‘plot.pdf’” is easy to solve : just remove the file “plot.pdf” from the root of the package.



As I mentioned, I am a novice. I did notice the plot.pdf file. I deleted it and received no errors, warnings or notes. “Check” gave me this:
==> devtools::check(cleanup = FALSE)

Updating CF documentation
Loading CF
Warning: The existing ‘NAMESPACE’ file was not generated by roxygen2, and will not be overwritten.
── Building ────────────────────────────────────────────────────────────────────────────── CF ──
Setting env vars:
● CFLAGS : -Wall -pedantic
● CXXFLAGS: -Wall -pedantic
Error in pkgbuild::build(pkg$path, tempdir(), quiet = quiet, args = build_args, :
unused argument (cleanup = FALSE)
Calls: -> -> force
Execution halted

Exited with status 1.

When I passed a vector and matrix, my function could not find one of them. I will try combining them as you suggest and see if that works.

Thanks so much.



You are right. Passing a single vector to a function works. ── 0 errors :heavy_check_mark: | 0 warnings :heavy_check_mark: | 0 notes :heavy_check_mark:

However, I get the following with devtools::check() warning: Warning in strptime(xx, f <- “%Y-%m-%d %H:%M:%OS”, tz = tz) :
unknown timezone ‘default/America/New_York’

“Check” does not work. Execution halted. Exited with status 1.

I cannot find how to fix “tz”. I suspect that it affects “Check”.

Thanks again. You have been a great help. I know that I will stumble on more RStudio mysteries.



Using the CRAN version of devtools should fix these issues, you can install it with



Thanks. install.packages(“devtools”) fixed the problem. I have new issues “checking.”

Issue 1: I have three functions.

trial2(63, 34, 22, 44, 40, 14) WORKS
Saving theta, t0, t1, t2, t3, ul0, ul1, ul2, ul3, xl0, xl1, xl2, xl3, h0, h1, h2, h3, uf0, uf1, uf2, uf3, xf0, xf1, xf2, xf3 as sysdata.rda to /Users/PJO/Desktop/CF/R
v1plot2(xlim, ylim) WORKS
Saving theta, t0, t1, t2, t3, ul0, ul1, ul2, ul3, xl0, xl1, xl2, xl3, h0, h1, h2, h3, uf0, uf1, uf2, uf3, xf0, xf1, xf2, xf3, tseq, xseq, useq, hseq as sysdata.rda to /Users/PJO/Desktop/CF/R
Called from: vfline2(xlim, ylim)
Browse[1]> c
Error: object ‘xseq’ not found

Issue 2: I am not sure the following is related to NOT Finding ‘xseq’.
I am finding conflicting instructions.
checking Rd \usage sections … WARNING
Check gives:
Documented arguments not in \usage in documentation object ‘trial2’:
‘theta’ ‘t0’ ‘t1’ ‘t2’ ‘ul0’ ‘ul1’, ‘xf3’ ‘tseq’ ‘useq’ ‘hseq’ ‘xseq’
Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.

These values, ‘theta’ ‘t0’ ‘t1’ …, are 'internal data," which I don’t have to be documented.
“Objects in R/sysdata.rda are not exported (they shouldn’t be), so they don’t need to be documented. They’re only available inside your package.”