← Back to R Course | Chapter 2: Variables & Types | Lesson 4 of 7

Character Type

In this page:

  1. Character Type

Character Type

R's character type stores text strings, written with single or double quotes. Unlike some languages, there's no separate single-character type -- a one-letter string is still character. String concatenation and formatting typically go through paste() rather than a + operator.

Note: Single and double quotes work identically for strings in R -- pick one style and stay consistent.

Example: Character Type

markup
name <- "Ada"
greeting <- 'Hello'

cat(class(name), "\n")
cat(greeting, name, "\n")
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.