Error connecting to help documenation

I receive an error when trying to connect to help documentation (.rd file) after installing a package I created. The function itself works fine, however I receive "Error in gzfile(file, "rb") : cannot open the connection" either when the pop up help shows while typing in the function name or when going to the help via '?'.

library(devtools)
library(roxygen)
setwd(workingdirectory)
create("helperColumns")

#' A helpful proportion column function
#
#' This function creates a proportion column based on a group.
#' @param df,group 
#' @keywords proportion
#' @import tidyverse
#' @export prop_column_group
#' @examples
#' prop_column_group(mtcars,cyl)
prop_column_group <- function(df, group){
  group <- enquo(group)
  df %>% count(!!group) %>% rename(Count = n) %>% mutate(Percent = round(Count/sum(.$Count) *100,3))
}

setwd("./helperColumns")
document()

setwd("..")
install("helperColumns")
library(helperColumns)
??prop_column_group

I think you forgot to ``` in order to format your post as code.

I think you're running into a bug in R - unfortunately after reloading a package (which install() does automatically) you often need to restart R in order to view the documentation.

Thanks for that response Hadley, I spaced on the fact that the code wasn't formatted. I'd assumed the same thing you said, but restarting the R session wasn't fixing the issue. Will update if I resolve the problem.

Hello, have you tried this?
From menu Tools -> Project Options at Build Tools tab:

Select Generate documentation with Roxygen and

on the Configure button select:
Automatically roxygenize when running: Build and reload

image

Moreover, every time you build and reload your package the documentation will automatically be updated!

2 Likes

Hello all,

Reviving this thread because I stumbled across it while trying to resolve the same problem. It turns out the issue is due to the package name; a package that starts with the characters 'help' will cause problems with the html documentation paths. I encountered the same behavior with my package helperUtils, and ended up finding the solution here.

Hopefully this saves some future headaches!

2 Likes