0% found this document useful (0 votes)
45 views1 page

Data Types in R Programming

The document outlines the primary data types in R, including Numeric, Character, Logical, Complex, and Special types such as Integer and Factor. It also describes various data structures available in R, such as Vectors, Matrices, Arrays, Data Frames, and Lists. Understanding these data types and structures is essential for effective data analysis in R.

Uploaded by

garvitmalik63
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views1 page

Data Types in R Programming

The document outlines the primary data types in R, including Numeric, Character, Logical, Complex, and Special types such as Integer and Factor. It also describes various data structures available in R, such as Vectors, Matrices, Arrays, Data Frames, and Lists. Understanding these data types and structures is essential for effective data analysis in R.

Uploaded by

garvitmalik63
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Data Types in R

R, like many other programming languages, has a variety of data types to represent different
kinds of data. Here are the primary data types in R:
1. Numeric Data Types:
● Numeric: Represents real numbers, including integers and decimal numbers.
x <- 10 # Integer
y <- 3.14 # Decimal number

2. Character Data Type:


● Character: Represents text strings.
name <- "Alice"

3. Logical Data Type:


● Logical: Represents Boolean values (TRUE or FALSE).
is_true <- TRUE
is_false <- FALSE

4. Complex Data Type:


● Complex: Represents complex numbers with real and imaginary parts.
z <- 2 + 3i

5. Special Data Types:


● Integer: Represents integer numbers.
● Factor: Represents categorical data.
● Date: Represents dates.
● POSIXct: Represents date and time.
Example:
# Creating a vector of different data types
my_vector <- c(10, "Hello", TRUE, 2+3i)

Data Structures in R:
R also provides several data structures to organize and store data:
● Vector: A one-dimensional array of elements of the same data type.
● Matrix: A two-dimensional array of elements of the same data type.
● Array: A multi-dimensional array of elements of the same data type.
● Data Frame: A tabular data structure with rows and columns, similar to a spreadsheet.
● List: A collection of objects of different data types.
By understanding these data types and data structures, you can effectively work with data in R
and perform various data analysis tasks.

You might also like