0
****library(readxl)
library(tidyverse)
library(xgboost)
library(caret)
library(dplyr)

setwd("C:/Users/ASMD/Desktop/R files jnefjenfjne")

Data1 = as.data.frame(read_excel("r.xlsx"), header = TRUE)
head(Data1)
summary(Data1)
dim(Data1)
names <- names(Data1)

set.seed(100)

inTrain <- createDataPartition(y=Data1$TLS, p = 0.8, list = FALSE )

training <-Data1[inTrain,]




testing <-Data1[-inTrain,]
**X_train = xgb.DMatrix(as.matrix(training %>% select(-TLS)))**


y_train = training$TLS
X_test = xgb.DMatrix(as.matrix(testing %>% select(-TLS)))
y_test = testing$TLS****

The error which pops up is:

X_train = xgb.DMatrix(as.matrix(training %>% select(-TLS))) Error in select(., -TLS) : unused argument (-TLS

Bill P
  • 3,622
  • 10
  • 20
  • 32
  • Welcome to SO, can you please provide sample data? Please follow the instructions here: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Otherwise its hard for people to understand – heck1 Oct 01 '19 at 08:16
  • Hey Bill ! I am new to R and this is my first piece of code. So, please bear with me. – Abhijeet Singh Oct 01 '19 at 08:45
  • here's, the sample data you are asking for ****TLS DevLLM DevLM DevCM DevSM1 DevSM2 DevH1 DevH2 3 632 938 1116 1116 -192 -1155 1155 4 317 38 -133 -133 -412 150 -150 2 186 162 -235 -235 -335 -154 154 3 261 278 64 64 -59 24 -24 3 213 102 23 23 -82 -132 132 1 59 140 146 146 20 -145 145 3 -313 -333 -77 -77 -370 250 -250 15 92 254 140 140 23 -130 130 7 16 18 3 3 -101 -54.5 54.5**** Basically TLS being dep variable and other predictor variables – Abhijeet Singh Oct 01 '19 at 08:47

0 Answers0