sd_add_question {surveydown} | R Documentation |
Add a Question Template to the Current Document
Description
This function inserts a template for a surveydown question at the current cursor position in the active RStudio document. It supports various question types and automatically removes the function call before inserting the template if it exists in the document.
Usage
sd_add_question(type = "mc", chunk = FALSE)
Arguments
type |
A character string specifying the type of question template to
insert.
Default is
|
chunk |
Logical. If |
Details
The function performs the following steps:
Checks for and removes any existing
sd_add_question()
function call in the document.Inserts the appropriate question template at the current cursor position.
Value
This function does not return a value. It modifies the active document as a side effect by inserting text and potentially removing a function call.
Examples
if (interactive()) {
library(surveydown)
# Insert a default multiple choice question template
sd_add_question()
# Insert a text input question template
sd_add_question("text")
# Insert a slider question template
sd_add_question("slider")
}