Complete the code to join the words with a space using paste.
result <- paste("Hello", "World", sep=[1]) print(result)
The paste function joins strings with the separator given by sep. Using a space " " joins words with a space.
Complete the code to join the words without any separator using paste0.
result <- paste0("Hello", [1], "World") print(result)
The paste0 function joins strings without any separator by default. Using an empty string "" explicitly means no separator.
Fix the error in the code to correctly join numbers and strings using paste.
result <- paste("Age:", [1]) print(result)
To join numbers with strings using paste, convert numbers to characters with as.character(). This avoids unexpected output.
Fill both blanks to create a named vector where names are uppercase and values are joined strings.
words <- c("apple", "banana", "cherry") names(words) <- toupper(words) result <- sapply(words, function(w) paste(w, [1], sep=[2]) print(result)
The function joins each word with the string "fruit" using a comma and space separator ", ".
Fill all three blanks to create a vector of joined strings with no separator and uppercase names.
words <- c("dog", "cat", "bird") names(words) <- [1](words) result <- sapply(words, function(w) paste0(w, [2], [3])) print(result)
tolower instead of toupper.paste instead of paste0.The names are uppercase using toupper. The strings are joined with an underscore and the word "pet" using paste0 which has no separator.