filename_from_prompt

Generate a filename from a prompt

Description

This function generates a filename from a prompt by removing all non-alphanumeric characters and replacing them with underscores. The filename is limited to 50 characters. If datetime is set to TRUE, the current date and time are prepended to the filename.

Usage

filename_from_prompt(prompt, datetime = TRUE)

Arguments

  • prompt: A character string representing the prompt.
  • datetime: Logical indicating whether to prepend the current date and time to the filename. Default is TRUE.

Value

A character string representing the generated filename.

Examples

filename_from_prompt("A beautiful sunset over the mountains")
filename_from_prompt("A beautiful sunset over the mountains", datetime = FALSE)