Skip to content

Instantly share code, notes, and snippets.

@abhishekdagarit
Last active October 30, 2017 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhishekdagarit/0a70bf644b036c6e014237f5e6055da9 to your computer and use it in GitHub Desktop.
Save abhishekdagarit/0a70bf644b036c6e014237f5e6055da9 to your computer and use it in GitHub Desktop.
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