Skip to content

Ugly hack to get staticdocs working

October 26, 2012

The staticdocs package is one of the latest amazing developments from the Wickham clik. It takes an R package (which uses roxygen2) and automatically generates an html version of the manual in the style of the ggplot2 site. There isn’t a stable version yet and the development version took some massaging (including a really ugly hack) to get working for me. I got the error:

Error in pkg_sd_path(package) : could not find function "dir.exists"
##install.packages('devtools') # get the latest if you don't have it
library(devtools)
install_github('staticdocs')
library(staticdocs)
dir.exists <- function(path) TRUE ## THE UGLY PART!
build_package('path_to_your_package', 'path_where_you_want_the_web_documentation')

Don’t ask why this works…I’m not sure. It may not work for you. I just noticed that the function dir.exists wasn’t available on my system for some reason (yes I had all of the listed recommended packages up-to-date and attached), and that it seemed to be needing a logical return value — so I made it TRUE because FALSE didn’t work. Maybe FALSE is what you need? I told you it was ugly!

Here’s an example…although this particular package probably won’t be very useful to many other people.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: