INTRODUCTION TO R

NOTES ON DATA CAMPS INTRODUCTION TO R
0

R

EASY

last hacked on Jul 15, 2018

Notes on [introduction to R course on DataCamp](https://www.datacamp.com/courses/free-introduction-to-r)

Arithmetic with R

# An addition
5 + 5 

# A subtraction
5 - 5 

# A multiplication
5 * 5

 # A division
(5 + 5) / 2 

# Exponentiation
2^5

# Modulo
28 %% 6

Variable assignment

# Assign the value 42 to x
x <- 93

# Print out the value of the variable x
93

Variable Assignment 2

# Add value of 3 to my_cats
my_cats <- 3

# Print out the value of my_cats
my_cats

Variable Assignment 3

# Add value of 3 to my_cats and value of 2 to my_dogs
my_cats <- 3
my_dogs <- 2

# Create new variable of my_pets
my_pets <- my_cats + my_dogs

# Print out my_pets
my_pets

Types of Data in R

Integers, numerics, logical, and characters are four basic types of data when being introduced to R.

# Variable ex_numeric to 2.5
ex_numeric <- 2.5

# Variable ex_integer to 2
ex_integer <- 2

# Variable ex_logical to TRUE
ex_logical <- TRUE

# Variable ex_text to "fun"
ex_text <- "fun"

COMMENTS







keep exploring!

back to all projects