Skip to contents

Docx to qmd format

This is an example of how to use the function for the applied epi manual. Note that there are other arguments you can adjust, read ?aetranslations::convert_docx_to_qmd.


# define which chapters you want to convert 
# (you only need to edit these - leave the rest)
chapters_interested <- c(3, 4, 7)

# read in a csv with chapter numbers and names
chp_names <- read.csv('assets/files/chapter_names.csv')

## Create lookup based on chapter number
chapters <- setNames(
  chp_names$chp_names,
  chp_names$number
)

# for each of the chapters of interest
for (i in chapters_interested) {
  aetranslations::convert_docx_to_qmd(
    # define the input document with the number
    input_path = paste0(
      "./original_msdocs/chapter",
      i,
      ".docx"
    ),
    # define the output path with the name
    output_name = chapters[i]
  )
}