I am at a loss as to where to ask these type of question so if this is not the right forum I would appreciate pointers to the right place to ask.
I am trying to devtools::build() my package disk.frame to prepare it for CRAN submission. But the build fails at building the vignette (see error below). But I can build vignette fine on its own. How do I go about diagnosing this?
You can install my package using
remotes::install_github("xiaodaigh/disk.frame")
The only thing I can think of that makes my vignette atypical is that t writes to disk. My package is all about storing data on the hard drive so the vignette does a fair bit of that. So I was going to comment out the code that does the writing to disk and see if issues persist.
Pointers appreciated!
Error:
√ checking for file 'C:\Users\UserName\git\git\disk.frame/DESCRIPTION' ...
`devtools::build()`
[/quote]
causes the error. But to get there you need
* Start a RStudio Project with Version Control
* The version control URL should be https://github.com/xiaodaigh/disk.frame
* then `devtools::build()`
I meant which line in the vignette was causing a problem, but that was a long shot whether you'd be able to tell. The build message isn't very specific. But it makes me think of a common scenario with this error message: it's shown when the "file path" is actually a directory path.
This is probably something with the code in your package. None of the non-package code in the vignette seems to have a problem. But it can still help to figure out which call in the Rmd gives the error.
A process to find it:
Insert this somewhere into a chunk in your Rmd:
stop("Everything works up to here")
Rebuild the package. Either the file error or the custom error will stop the process.
If it was the file error, move the custom stop() one line higher. If it was the custom error, move it one line lower. (Or, to minimize the time and learn a neat algorithm, move it according the binary search algorithm.)
When moving the custom stop() command by a single line changes which error stops the process, you've found the culprit line.
After that, you'll need to dig into your package's code.
Total guess
Many of the functions in R/disk.frame.r assume there are only files in the directory named in a disk.frame's "path" attribute. For example:
head.disk.frame <- function(df, n = 6L, ...) {
stopifnot(is_ready(df))
path1 <- attr(df,"path")
cmds <- attr(df, "lazyfn")
if(dir.exists(path1)) {
path2 <- list.files(path1,full.names = T)[1]
head(disk.frame:::play(fst::read.fst(path2, from = 1, to = n, as.data.table = T), cmds), n = n, ...)
} else {
head(disk.frame:::play(fst::read.fst(path1, from = 1, to = n, as.data.table = T), cmds), n = n, ...)
}
}