Bioconductor / BiocStyle

Issues and pull requests for BiocStyle should go here.
12 stars 19 forks source link

Error in if (is.na(options$out.width.px)) argument is length zero #81

Closed emiliesecherre closed 3 years ago

emiliesecherre commented 3 years ago

Hello ! My .Rmd file header is

`title: 'Mypkg' author: "Emilie" package: mypkg output: BiocStyle::html_document vignette: > %\VignetteIndexEntry{mypkg} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8}

BiocStyle::markdown()

Though, when the r chunk above is executed, this error occur : Error in if (is.na(options$out.width.px)) options$out.width.px = options$fig.width * argument is length zero Calls: <Anonymous> ... process_group.block -> call_block -> as.strict_list -> hook

How can i fix that ?

grimbough commented 3 years ago

Please update your version of BiocStyle with:

BiocManager::install('BiocStyle')

The problem should then go away. This assumes you're using the latest version of R (4.0) and Bioconductor (3.11).

emiliesecherre commented 3 years ago

Thx, but now a new error occur : i can't use library(mypkg) in a r chunk (error : there is no package called "mypkg").

I'm using Bioconductor 3.11 and R 4.0.2

grimbough commented 3 years ago

Running library(mypkg) assumes that you have installed a package called "mypkg". If that's not the case then you'll get the error you're seeing.

The examples in the BiocStyle vignette assume you're using the package to style your own vignette in a package - in this case your own package should be called "mypkg" or more likely you should substitute "mypkg" in the Rmd header for the actual name of your own package. You'll also need to make sure you've installed this new package at least once.

If you're writing a stand-alone Rmd file and just want to use the styling from BiocStyle then you can omit the "mypkg" parts from the header.

If that doesn't help then I think you probably need to provide some more context for the document you're trying to create.

emiliesecherre commented 3 years ago

I'm trying to style my package's vignette using BiocStyle. I renamed the 'title' section of the header and the Rmd file using my package's name. Then, should i install my own package ?

grimbough commented 3 years ago

Assuming you're working in RStudio, if you're pressing the 'knit' button to compile your vignette you'll need to install the package beforehand. This only needs to be done once, then the package will be in your library.

It might also be useful to take a look at how some other packages have formatted their header - copying other peoples' examples is normally my go to solution for figuring things like this out. You can find lots of instances here on Github, for example the DelayedArray vignette is at https://github.com/Bioconductor/DelayedArray/blob/master/vignettes/02-Implementing_a_backend.Rmd

emiliesecherre commented 3 years ago

I'll try to install my package then, thank you !

grimbough commented 3 years ago

Hopefully this is resolved. Please re-open if not.