-
Notifications
You must be signed in to change notification settings - Fork 0
/
Transformation_Bating.R
17 lines (14 loc) · 1 KB
/
Transformation_Bating.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ------------------------ It deals with transforming the predictor variables to feed according to the PCA model deployed in Python
#Data Load
library(readxl)
d= read_excel("jos_raw.xlsx")
View(d)
#Data Transformation
d$PC1 = ((-0.004390014)*d$NO)+((-0.206135952)*d$AVG)+((-0.954977131)*d$BF)+((-0.143009283)*d$SR)+((-0.001822171)*d$`100`)+((-0.010512970)*d$`50`)+((-0.140155797)*d$`4S`)+((-0.072788951)*d$`6S`)
d$PC2 = ((0.0053420356)*d$NO)+((0.1197771531)*d$AVG)+((-0.1772873319)*d$BF)+((0.9750834830)*d$SR)+((0.0002296697)*d$`100`)+((0.0030177066)*d$`50`)+((0.0063965098)*d$`4S`)+((0.0579329335)*d$`6S`)
d$PC3 = ((-0.0457504257)*d$NO)+((-0.9682368592)*d$AVG)+((0.1763452449)*d$BF)+((0.1516984763)*d$SR)+((-0.0009854498)*d$`100`)+((-0.0042542952)*d$`50`)+((0.0777294403)*d$`4S`)+((-0.0159145808)*d$`6S`)
d
# If not Installed-- install.packages("openxlsx")
library(openxlsx)
file_path <- "jos_trans.xlsx"
write.xlsx(d, file_path)