Error connecting to help documenation


#1

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

#2

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.


#3

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.


#4

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!