I am trying to import the dataset into R to apply linear regression model, but am skeptical of my code as am new to R. The dataset is as follows with 5000+ rows of data:
power consumption
cputi
dbsu
as the column names and the followings integers as their values in the above column:
132
25
654
The sql code to call R function which I wrote is
CREATE COLUMN TABLE "PREDICTIVE ANALYSIS" LIKE "ANAGAPPAN.POWER_CONSUMPTION" WITH NO DATA;
SELECT POWER_APP, POWER_DB,CPUTI,DBTI,DBSU
FROM "ANAGAPPAN.POWER_CONSUMPTION";
DROP PROCEDURE USE_LM;
CREATE PROCEDURE USE_LM( IN train "ANAGAPPAN.POWER_CONSUMPTION", OUT result "PREDICTIVE ANALYSIS")
LANGUAGE
RLANG AS
BEGIN
library(lm)
model_app <- lm( POWER_APP ~ CPUTI + DBTI + DBSU + KBYTES_TRANSFERRED, data = train )
colnames(datOut) <- c("POWER_APP", "CPUTI", "DBTI", "DBSU", "DBSU")
PREDICTIVE ANALYSIS <- as.data.frame( lm(model_App))
END;
The result I obtain is it says the procedure is created but am unable to call the linear model on the data, how would I initiate the linear model?