Overview

This vignette shows how developers can add their own custom table templates to the autoslider.core package. This is useful if you’re extending the package with your own commonly used table logic and want it to integrate with the list_all_templates() and use_template() framework.

Step 1: Write your template

First, navigate to the R/ directory. For example, if you are creating a new custom table:

cd ~/autoslider.core/R
nano t_my_custom_table.R

Then you can start editing the template contents inside the file. Be sure to follow naming conventions: templates should start with t_, l_, or g_ to be detected.

Step 3: Verify with list_all_templates()

Load the package and call:

devtools::load_all()
list_all_templates()

Your new template t_my_custom_table should appear in the list.

Step 4: Generate with use_template()

You can now use your template like any built-in one:

use_template(
  template = "t_my_custom_table",
  function_name = "custom_table_slide",
  open = TRUE
)

This will create a new file at ./programs/R/custom_table_slide.R based on your template.