0% found this document useful (0 votes)
1 views12 pages

Etl See

SEE

Uploaded by

Santhosh Y M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views12 pages

Etl See

SEE

Uploaded by

Santhosh Y M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

EMERGING TECHNOLOGY LABORATORY - 21CSL69B

PART – 2 – DATA SCIENCE

R – Programming [10 Commands]

COMMANDS OUTPUT

1) If- else b is greater than a

a <- 33
b <- 200

if (b > a) {
print("b is greater than a")
}

2) While Loop [1] 1


[1] 2
i <- 1 [1] 3
while (i < 6) { [1] 4
print(i) [1] 5
i <- i + 1
}

3) For Loop [1] 1


[1] 2
for (x in 1:5) { [1] 3
print(x) [1] 4
} [1] 5

4) R Vectors 1] "banana" "apple" "orange"

# Vector of strings
fruits <- c("banana", "apple", "orange")

# Print fruits
fruits

5) R-List [[1]]
[1] "apple"
thislist <-list("apple", "banana", "cherry")

thislist[1]

6) R-Matrix
EMERGING TECHNOLOGY LABORATORY - 21CSL69B

# Create a matrix [,1] [,2]


thismatrix <- matrix(c(1,2,3,4,5,6), nrow = 3,
ncol = 2) [1,] 1 4

# Print the matrix [2,] 2 5


thismatrix
[3,] 3 6

7) R – Line Plot

plot(1:10, type="l", col="blue")

8) R – Scatter Plot

x <- c(5,7,9,1,2)

y <- c(10,20,30,40,50)

plot(x, y, main="Cars", xlab="Age", ylab="Speed")

9) R – Pie Plot

x <- c(10,20,30,40)

y <- c("Apples", "Bananas", "Cherries", "Dates")

pie(x, y, main = "Fruits")

10) R – Bar Plot

# x-axis values
x <- c("A", "B", "C", "D")

# y-axis values
y <- c(2, 4, 6, 8)

barplot(y, names.arg = x)

You might also like