roxygen2 not creating documentation

I am beginning to explore creating functions and documenting them and am having trouble getting roxygen2 to generate the documentation.
Rstudio - 2023.03.0 Build 386
R - 4.2.2 and have also tried 4.3.0

I created a DESCRIPTION text file which contains the following:

Package: SCCTempConverter
Type: Package
Title: Temperature Conversion Package for Demonstration
RoxygenNote: 7.2.3
Encoding: UTF-8

I then created an R script file with the following:

#' @description
#' Fahrenheit conversion
#' Convert degrees Fahrenheit temperatures to degrees Celsius
#' @param F_temp The temperature in degrees Fahrenheit
#' @return The temperature in degrees Celsius
#' @examples
#' temp1 <- F_to_C(50);
#' temp2 <- F_to_C( c(50, 63, 23) );
#' @export

F_to_C <- function(F_temp){
  C_temp <- (F_temp - 32) * 5/9;

#' @description
#' Celsius conversion
#' Convert degrees Celsius temperatures to degrees Fahrenheit
#' @param C_temp The temperature in degrees Celsius
#' @return The temperature in degrees Fahrenheit
#' @examples
#' temp1 <- C_to_F(22);
#' temp2 <- C_to_F( c(-2, 12, 23) );
#' @export

C_to_F <- function(C_temp){
  F_temp <- (C_temp * 9/5) + 32;

When I run devtools::document() or roxygen2::roxygenise() it creates the file NAMESPACE and the folder man but both are empty. What am I missing here? I started the project as a new project.


Can you share your project on GitHub or some other way?

I have uploaded the project folder "Test_functions" here: GitHub - edwelch802/R_code_sandbox: Sandbox for sharing code. Not knowing how best to export the project, I also used the "Build Source Package" which created the tar file that is in this same folder.

I figured out the issue. It has to do with the folder structure within the project. The function scripts or any script with documentation embedded needed to be in a child folder within the project and not at the root level. Once I moved the script to a sub-folder, it worked perfectly.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.