Skip to content
Justice Tech School

R Strings

Strings use quotes. Functions: nchar, toupper, tolower, substr, paste, paste0, sprintf, gsub and strsplit. paste joins with a space and paste0 with none.

Example
s <- "Hello, R"
print(nchar(s)); print(toupper(s)); print(substr(s, 1, 5))
print(paste("a", "b")); print(paste0("a", "b"))
print(gsub("R", "World", s))

Exercise

Join without a space.

("a", "b")

Quiz Test

Which joins strings without a space?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.