Learn R Programming

risk.assessr (version 3.0.1)

contains_vignette_folder: Check for Vignette Folder and .Rmd Files in a .tar File

Description

This function checks if a given .tar file contains a 'vignettes' folder and if there is at least one .Rmd file within that folder. If both 'vignettes' and 'inst/doc' folders exist, the function will return FALSE.

Usage

contains_vignette_folder(tar_file)

Value

A logical value: TRUE if the 'vignettes' folder exists and contains at least one .Rmd file, and neither 'vignettes' nor 'inst/doc' folders are present, FALSE otherwise.

Arguments

tar_file

A character string specifying the path to the .tar file to be checked.

Details

The function checks if the specified file exists and has a valid .tar extension using utils::untar. If the file is empty or any error occurs during the extraction, the function stops and returns an error message. If both 'vignettes' and 'inst/doc' folders exist, the function returns FALSE. If the 'vignettes' folder exists and contains at least one .Rmd file, the function returns TRUE. Otherwise, it returns FALSE.

Examples

Run this code
if (FALSE) {
  tar_file <- system.file("test-data", "here-1.0.1.tar.gz", 
   package = "risk.assessr")
  result <- contains_vignette_folder(tar_file)
  print(result)
}

Run the code above in your browser using DataLab