Skip to content

Commit 69832d0

Browse files
committed
fix: fix and improvemets
1 parent 03dfe82 commit 69832d0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

vignettes/advanced.Rmd

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ You can combine the greeting functions with other text to create more personaliz
6161
```{r}
6262
create_welcome_message <- function(name, language = "english") {
6363
greeting <- suppressMessages(hello(name, language, exclamation = TRUE))
64-
64+
6565
# Add a personalized message
6666
additional_text <- switch(
6767
language,
@@ -73,10 +73,10 @@ create_welcome_message <- function(name, language = "english") {
7373
italian = "Benvenuto nella nostra applicazione.",
7474
"Welcome to our application."
7575
)
76-
76+
7777
message <- paste(greeting, additional_text)
7878
cat(message, "\n")
79-
79+
8080
invisible(message)
8181
}
8282
@@ -128,7 +128,7 @@ library(shiny)
128128

129129
ui <- fluidPage(
130130
titlePanel("Multilingual Greeter"),
131-
131+
132132
sidebarLayout(
133133
sidebarPanel(
134134
textInput("name", "Your Name:", "world"),
@@ -142,7 +142,7 @@ ui <- fluidPage(
142142
checkboxInput("exclamation", "Add Exclamation Mark", TRUE),
143143
checkboxInput("capitalize", "Capitalize Name", FALSE)
144144
),
145-
145+
146146
mainPanel(
147147
h3("Greeting:"),
148148
verbatimTextOutput("greeting"),
@@ -158,7 +158,7 @@ server <- function(input, output) {
158158
hello(input$name, input$language, input$exclamation, input$capitalize)
159159
)
160160
})
161-
161+
162162
output$farewell <- renderText({
163163
suppressMessages(
164164
goodbye(input$name, input$language, input$exclamation, input$capitalize)
@@ -180,34 +180,34 @@ silent_hello <- function(name = "world", language = "english", exclamation = TRU
180180
if (!is.character(name) || length(name) != 1) {
181181
stop("'name' must be a single character string")
182182
}
183-
183+
184184
# Capitalize name if requested
185185
if (capitalize) {
186186
name <- paste0(toupper(substr(name, 1, 1)), substr(name, 2, nchar(name)))
187187
}
188-
188+
189189
# Select greeting based on language
190190
greeting <- switch(
191191
language,
192192
english = "Hello",
193193
spanish = "Hola",
194194
french = "Bonjour",
195-
portuguese = "Olá",
195+
portuguese = "Olá",
196196
german = "Hallo",
197197
italian = "Ciao",
198198
"Hello"
199199
)
200-
200+
201201
# Construct the greeting
202202
result <- paste0(greeting, ", ", name)
203-
203+
204204
# Add exclamation mark if requested
205205
if (exclamation) {
206206
result <- paste0(result, "!")
207207
} else {
208208
result <- paste0(result, ".")
209209
}
210-
210+
211211
# Return the greeting (without printing)
212212
return(result)
213213
}

0 commit comments

Comments
 (0)