ereedsanchez / Learning-R-1-2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Learning R @ Belmont

Hello, I am Edwin Reed-Sanchez and I love to program, hack and tinker with technology. I also enjoy teaching students the basic programming principals that are universal with all programming languages.

For this class we will be learning R, which is a widely programming language used for statistical and scientific analysis.

Information about R

Software for Class

Sign up for Replit using your gmail account.

Lesson 1 - The Basics

Today we will learn about basic programs and syntax used in R.

Print

print(“text”)

Commenting

#Comments your code

Variables using =

x = 51
print(x)
name =sam”
print(sam)

Variables using <-

leftward <- operator

X <- 42
print(X);
x <- 9
y <- 3 
x <- y 
print(x)

Data Types - Numbers

#numeric
var1 <- 3.14

#integer
var2 <- 88L

print(var1)
print(var2)

Data Types - Strings - Simple Text

#text
var3 <- "hello"
print(var3)

Data Types - Strings - quotations

message <- "This is called \"escaping\"."
print(message) 

will return

[1] "This is called \"escaping\"."

message <- "This is called \"escaping\"."
cat(message)

will return

[1] "This is called "escaping".

Lesson 2 - Basic Math

Arithmetic
x <- 11
y <- 4

#addition
print(x+y)

#substraction
print(x-y)

#multiplication
print(x*y)

#division
print(x/y)
Arithmetic Operators
x <- 11
y <- 4

#exponentation
print(x^y) #or x**y

#modulus (remainder from division)
print(x%%y)

#integer division
print(x%/%y)

Resources

Producing Simple Graphs with R

Simple Bar Graphs in R

About

License:MIT License