Skip to content

giladfeldman/stat2rmarkdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stat2rmarkdown

Shared core utilities for the family of statistical software to R Markdown converter packages:

Installation

# Install from the monorepo
devtools::install("pkg/stat2rmarkdown")

What's included

Utility functions (utils.R)

Function Description
%||% Null-coalescing operator
quote_var() Backtick-quotes variable names with special characters
create_output_dir() Creates timestamped output directories
validate_vars() Validates variable names exist in a data frame
safe_as_numeric() Safe numeric conversion from factor/character/labelled
log_message() Timestamped logging utility

R Markdown skeleton (rmd_skeleton.R)

Function Description
generate_yaml_header() Creates YAML front matter for html_document output
generate_setup_chunk() Creates knitr setup chunk with package loading
generate_session_footer() Creates sessionInfo() footer section

Usage

library(stat2rmarkdown)

# Quote variables with special characters
quote_var("income (USD)")
#> "`income (USD)`"

# Generate R Markdown components
yaml <- generate_yaml_header("My Conversion", author = "Generated by spss2rmarkdown")
setup <- generate_setup_chunk(packages = c("haven", "dplyr", "fixest"))
footer <- generate_session_footer(tool_name = "spss2rmarkdown")

# Assemble a document
rmd_content <- paste(yaml, setup, "# Analysis\n\n...\n", footer, sep = "\n")

License

MIT

About

R package: Shared core utilities for the 2Rmarkdown converter family (R Markdown assembly, variable quoting, logging)

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages