0% found this document useful (0 votes)
34 views4 pages

R - Data Types

This document provides an overview of key concepts in the R programming language including data types, variables, operators, decision making, loops, functions, strings, vectors, lists, matrices, arrays, factors, data frames, packages, and data reshaping. It covers topics such as creating and manipulating different data structures, writing control flow statements, defining and calling functions, and importing/exporting/reshaping data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views4 pages

R - Data Types

This document provides an overview of key concepts in the R programming language including data types, variables, operators, decision making, loops, functions, strings, vectors, lists, matrices, arrays, factors, data frames, packages, and data reshaping. It covers topics such as creating and manipulating different data structures, writing control flow statements, defining and calling functions, and importing/exporting/reshaping data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

R - Data Types

1. Logical
2. Numeric
3. Integer
4. Complex
5. Character
6. Raw
Vectors
Lists
Matrices
Arrays
Factors
Data Frames

R Variables

Nomenclature
Variable Assignment
Data Type of a Variable
Finding Variables
Deleting Variables

R Operators
Types of Operators

Arithmetic Operators
Relational Operators
Logical Operators
Assignment Operators
Miscellaneous Operators

R - Decision making

If statement
If...else statement
Switch statement

R Loops

Repeat loop
While loop
for loop

Loop Control Statements

break statement

next statement

R Functions

Function Definition
Function Components
Built-in Function
User-defined Function
Calling a Function
Calling a Function without an Argument
Calling a Function with Argument Values (by position and by name)
Calling a Function with Default Argument
Lazy Evaluation of Function

R Strings

Rules Applied in String Construction


String Manipulation
1. Concatenating Strings - paste() function
2. Formatting numbers & strings - format() function
3. Counting number of characters in a string - nchar() function
4. Changing the case - toupper() & tolower() functions
5. Extracting parts of a string - substring() function

R Vectors

Vector Creation
1. Single Element Vector
2. Multiple Elements Vector
I.
Using colon operator with numeric data
II.
Using sequence (Seq.) operator
III.
Using the c() function
Accessing Vector Elements
Vector Manipulation
1. Vector arithmetic
2. Vector element recycling
3. Vector Element Sorting

R Lists

Creating a List
Naming List Elements
Accessing List Elements
Manipulating List Elements
Merging Lists

Converting List to Vector

R Matrices

Accessing Elements of a Matrix


Matrix Computations
1. Matrix Addition & Subtraction
2. Matrix Multiplication & Division

R - Arrays

Naming Columns and Rows


Accessing Array Elements
Manipulating Array Elements
Calculations Across Array Elements

R Factors

Factors in Data Frame


Changing the Order of Levels
Generating Factor Levels

R - Data Frames

Create Data Frame


Get the Structure of the Data Frame
Summary of Data in Data Frame
Extract Data from Data Frame
Expand Data Frame
1. Add Column
2. Add Row

R Packages

Check Available R Packages


Get the list of all the packages installed
Install a New Package
1. Install directly from CRAN
2. Install package manually
Load Package to Library

R - Data Reshaping

Joining Columns and Rows in a Data Frame


Merging Data Frames
Melting and Casting
Melt the Data
Cast the Molten Data

You might also like