****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****
弹出的错误是:
X_train = xgb.DMatrix(as.matrix(training%>%select(-TLS)))错误 select(。,-TLS):未使用的参数(-TLS