Skip to content

RChandana/R

Repository files navigation

R

Basic Operations

9

Screenshot 2023-01-10 at 8 52 39 PM

pi

Screenshot 2023-01-10 at 8 53 30 PM

100 %% 5

Screenshot 2023-01-10 at 8 53 49 PM

100 %% 7

Screenshot 2023-01-10 at 8 54 08 PM

4 : 10

Screenshot 2023-01-10 at 8 54 51 PM

5 : -5

Screenshot 2023-01-10 at 8 55 06 PM

1 / 0

Screenshot 2023-01-10 at 8 55 20 PM

0 / 0

Screenshot 2023-01-10 at 8 55 48 PM

-1 / 0

Screenshot 2023-01-10 at 8 56 06 PM

All together :

Screenshot 2023-01-10 at 8 57 04 PM

Vector Operations

vector = c(11, 42, 93, 77, 15, 69, 27, 98, 9, 160)

Screenshot 2023-01-11 at 11 10 56 AM

vector

Screenshot 2023-01-11 at 11 12 32 AM

vector[5]

Screenshot 2023-01-11 at 11 13 11 AM

class(vector)

Screenshot 2023-01-11 at 11 13 43 AM

min(vector)

Screenshot 2023-01-11 at 11 14 16 AM

max(vector)

Screenshot 2023-01-11 at 11 14 55 AM

length(vector)

Screenshot 2023-01-11 at 11 16 37 AM

vector_2 = c("a", "b", "c", "d", "e")

Screenshot 2023-01-11 at 11 17 02 AM

vector_2

Screenshot 2023-01-11 at 11 17 22 AM

All together

Screenshot 2023-01-11 at 11 18 50 AM

Logical Operations

num = c(10, 20, 30, 40, 50)

Screenshot 2023-01-11 at 9 37 05 PM

num < 20 | num > 40

Screenshot 2023-01-11 at 9 37 29 PM

all (num > 0)

Screenshot 2023-01-11 at 9 38 04 PM

any (num > 20)

Screenshot 2023-01-11 at 9 38 20 PM

sqrt(81)

Screenshot 2023-01-11 at 9 38 43 PM

sqrt(-1)

Screenshot 2023-01-11 at 9 39 06 PM

sqrt(-1 + 0i)

Screenshot 2023-01-11 at 9 39 26 PM

sqrt(as.complex(-10))

Screenshot 2023-01-11 at 9 40 14 PM

x < 10

Screenshot 2023-01-11 at 9 40 40 PM

x

Screenshot 2023-01-11 at 9 41 10 PM

x = x + 20

Screenshot 2023-01-11 at 9 41 34 PM

a = c(1, 2, 3, 4) b = c(5, 6, 7, 8)

Screenshot 2023-01-11 at 9 42 20 PM

a + b

Screenshot 2023-01-11 at 9 42 33 PM

a*b

Screenshot 2023-01-11 at 9 42 54 PM

a - b

Screenshot 2023-01-11 at 9 43 11 PM

b%%a

Screenshot 2023-01-11 at 9 43 28 PM

b/a

Screenshot 2023-01-11 at 9 44 27 PM

a^2

Screenshot 2023-01-11 at 9 44 43 PM

d = list(1, 2, 3, 4)

Screenshot 2023-01-11 at 9 45 29 PM

help(list)

Screenshot 2023-01-11 at 10 15 57 PM

Matrix Operations

Matrix = matrix(c(1, 3, 5, 7, 9, 11, 13, 15, 17), nrow = 3, ncol = 3, byrow = TRUE)

Screenshot 2023-01-12 at 4 15 46 PM

Matrix[2,] #display 2nd row

Screenshot 2023-01-12 at 4 16 02 PM

Matrix[,3] #display 3rd column

Screenshot 2023-01-12 at 4 16 32 PM

Matrix[1,3] #display 1st row and 3rd column

Screenshot 2023-01-12 at 4 16 58 PM

Matrix[, c(1, 2)] #display 1st and 2nd column only

Screenshot 2023-01-12 at 4 17 26 PM

t(Matrix) #Transpose of Matrix

Screenshot 2023-01-12 at 4 17 53 PM

Matrix_2 = matrix(c(10, 20, 30, 40, 50, 60), nrow = 3, ncol = 2, byrow = FALSE)

Matrix_3 = matrix(c(70, 80, 90), nrow = 3, ncol = 1)

Matrix_4 = cbind(Matrix_2, Matrix_3)

Screenshot 2023-01-12 at 4 19 16 PM

All Together

Screenshot 2023-01-12 at 4 26 25 PM

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published