Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
R basics

Assignment operator

Assign the value 42 to x

x <- 31
Other_shit <- 4

#Printing

x

Maths with R

# Addition
15 + 35 

# Subtraction
25 - 35 

# Multiplication
63 * 25

# Division
(25 + 55) / 12 

# Exponentiation
32^15

# Modulo
218 %% 69

Data types

  1. Decimals 14.5 are called numerics
  2. Natural numbers like 5
  3. Boolean values (TRUE or FALSE). Also called logical
  4. Text (or string) values are called characters

Checking data types

# Checking class of num
class(num)

# Checking class of char
class(char)

# Checking class of logical
class(logic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.