Prerequisites: R Installation
Prerequisites: R Installation
1. R Installation:
If you don't have R installed, follow these steps:
2. Necessary Packages:
For the tasks, you will need the following R packages:
o ggplot2
o stats
o caret
o arules
To get input from the user and perform numerical operations like MAX, MIN, AVG, SUM, SQRT, and
ROUND.
Code: R
# Perform operations
# Output results
To perform data import/export operations for .CSV, .XLS, and .TXT formats using data frames in R.
Code:R
write.csv(data_csv, "output.csv")
write.table(data_txt, "output.txt")
install.packages("readxl")
library(readxl)
Code:R
# Input matrices
# Perform operations
# Output results
Code:R
# Input numbers
# Calculate statistics
# Output results
Code: R
# Min-Max Normalization
# Output results
Code: R
data(iris)
summary(iris_pca)
plot(iris_pca)
Task 7: Simple Linear Regression in R
Code: R
summary(model)
plot(mtcars$wt, mtcars$mpg)
abline(model)
Task 8: K-Means Clustering
Code: R
data(iris)
Code: R
library(caret)
set.seed(123)
confusionMatrix(pred_knn, testData$Species)
Task 10: Market Basket Analysis using Apriori Algorithm
Code: R
library(arules)
data("Groceries")
inspect(head(rules))