Problem with document() and data: object not found

568 views
Skip to first unread message

Josef Fruehwald

unread,
Sep 30, 2014, 12:29:57 PM9/30/14
to rdev...@googlegroups.com
I'm trying to put together a little R package to distribute data with some collaborators, and I'm getting an error that is driving my nuts, because it's not affecting another package I'm also working on, and as far as I can tell I'm doing things exactly the same.

I've got a clean R session, nothing in the environment, and I've loaded devtools.
> session_info()
Session info------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.1.1 (2014-07-10)
 system   x86_64, darwin13.1.0        
 ui       RStudio (0.98.1062)         
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       Europe/London               

Packages----------------------------------------------------------------------------------------
 package    * version    date       source                          
 devtools   * 1.6.0.9000 2014-09-30 Github (hadley/devtools@447866d)
 rstudioapi   0.1        2014-03-27 CRAN (R 3.1.0)         

roxygen2 is managing all of the documentation, namespace, etc. I have an .rda file saved in the data/ directory, called "um.rda" 

> system("ls data/")
um.rda

I have an R file in the R directory called data.R

> system("ls R")
UhUm.R
data.R
nonce.R

The contents of data.R right now are

#' Uh and Um data from the PNC
#' @format a data frame
#' @source Philadelphia Neighborhood Corpus
"um"

When I run document(), this is what I get

> document()
Updating UhUm documentation
Loading UhUm
Error: Failure in roxygen block beginning data.R:1
object 'um' not found

Any suggestions about what I'm missing?

-Joe

Hadley Wickham

unread,
Sep 30, 2014, 12:33:20 PM9/30/14
to Josef Fruehwald, rdev...@googlegroups.com
What does (load("data/um.rda")) give ?
> --
> You received this message because you are subscribed to the Google Groups
> "devtools" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rdevtools+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
http://had.co.nz/

Josef Fruehwald

unread,
Sep 30, 2014, 12:35:29 PM9/30/14
to rdev...@googlegroups.com, jofr...@gmail.com
> (load("data/um.rda")) 
[1] "um"

-Joe

Josef Fruehwald

unread,
Sep 30, 2014, 1:00:51 PM9/30/14
to rdev...@googlegroups.com, jofr...@gmail.com
Resolved the problem. I hadn't set LazyData: true in the description file. I guess this is something to take up with RStudio, but starting a new package using the New Project>R Package in RStudio doesn't include LazyData: true in the description, while devtools::create() does. 

-Joe

Hadley Wickham

unread,
Sep 30, 2014, 2:20:16 PM9/30/14
to Josef Fruehwald, rdev...@googlegroups.com
Yeah, using the create new project dialog is not currently
recommended. Fixing it to use devtools::create() is on the to do
list.

Hadley
Reply all
Reply to author
Forward
0 new messages