Menu
Coddy logo textTech

Character Data Type

Part of the Fundamentals section of Coddy's R journey — lesson 6 of 78.

The character data type is R's way of storing text information. In other programming languages, this is often called a "string," but R uses the term "character."

The character data type is used to store any text, whether it's a single word, a sentence, or even just a single letter. To create a character variable, you enclose your text in double quotes <strong>“”</strong> and use the assignment operator you've already learned:

name <- "Alice"
message <- "Welcome to R programming"

The double quotes tell R that everything inside should be treated as text, not as code. This means you can store names, addresses, descriptions, or any other textual information in character variables.

challenge icon

Challenge

Easy

Create a character variable called greeting that stores the message "Hello, John!" Then display the greeting using the print() function.

Try it yourself

# TODO: Write your code here

# Display the greeting
print(greeting)
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals