R TutorialLesson 10Free preview
R Strings
This lesson is part of R · All levels
Summary
This lesson discusses the manipulation of text (String/Character) in R. In R, the string is flanked by a double or single quotation. Developers will learn basic text processing functions such as nchar() to calculate character length, paste() to combine strings, as well as the pattern search function grepl().
Key points
- Strings can be paired with double quotes '"' or single quotes ''
- The 'nchar()' function calculates the number of characters in a string (not the length of the vector)
- The functions 'paste()' and 'paste0()' combine several strings into one
- The 'toupper()' and 'tolower()' functions convert text into capital or lowercase letters
- The 'grepl()' function searches for the existence of a substring or regex pattern
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.