r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 755 forks source link

Solution to the "checking examples ... ERROR" #2550

Closed nvietto closed 6 months ago

nvietto commented 6 months ago

I was getting the error below for a package I'm working on, I don't know if anyone has gotten this error but the solution is to head to the "man" file in your project and delete the hello.Rd file. The file automatically thrown in when you create a package using the project drop down feature in RStudio.

❯ checking examples ... ERROR Running examples in ‘packagename-Ex.R’ failed The error most likely occurred in:

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

Name: hello

Title: Hello, World!

Aliases: hello

** Examples

hello() Error in hello() : could not find function "hello" Execution halted

Might be useful to remove the automatic hello.Rd file from that option or add a note.

Thanks!

jennybc commented 6 months ago

I can't replicate this (and, even if I could, it would really be an RStudio problem). The package RStudio creates for me does contain man/hello.Rd. But it also defines a function hello() in R/hello.R and exports it via the NAMESPACE. I can immediately pass R CMD check with devtools::check().