Chociaż pytanie wydaje się być duplikatem, zamieszczam to jako że nie dali mi rozwiązania i istotnego dla mojego problemu.PRAWDA() może być zastosowana tylko do "numerycznej", a nie "całkowitej"
dtrain<-xgb.DMatrix(data=data.matrix(train),label=data[t,c(31)])
Błąd xgb.DMatrix (dane = data.matrix (pociąg), etykieta = danych [t, C (31)]) Real() może być stosowany tylko do 'numeryczny' nie a 'całkowitą'
> class(data[t,c(31)])
[1] "integer"
> str(train)
'
data.frame': 1965 obs. of 30 variables:
$ having_IP_Address : int 2 2 2 2 2 2 2 2 2 2 ...
$ URL_Length : int 3 3 3 3 3 3 3 3 3 3 ...
$ Shortining_Service : int 1 1 1 1 1 1 1 1 1 1 ...
$ having_At_Symbol : int 1 1 1 1 1 1 1 1 1 1 ...
$ double_slash_redirecting : int 2 2 2 2 2 2 2 2 2 2 ...
$ Prefix_Suffix : int 2 2 1 2 3 2 1 1 3 1 ...
$ having_Sub_Domain : int 1 2 1 1 1 3 1 2 1 1 ...
$ SSLfinal_State : int 2 2 2 1 2 2 1 2 2 2 ...
$ Domain_registeration_length: int 3 1 3 2 2 1 2 3 2 1 ...
$ Favicon : int 1 2 1 1 1 1 1 1 2 1 ...
$ port : int 1 2 1 1 1 1 1 1 2 1 ...
$ HTTPS_token : int 2 2 2 2 2 2 2 2 2 2 ...
$ Request_URL : int 1 1 1 2 2 1 2 1 2 1 ...
$ URL_of_Anchor : int 2 2 2 2 2 3 1 2 3 1 ...
$ Links_in_tags : int 3 2 3 3 1 3 2 1 3 2 ...
$ SFH : int 1 1 1 1 1 1 1 1 1 1 ...
$ Submitting_to_email : int 2 1 2 2 2 2 2 1 1 2 ...
$ Abnormal_URL : int 2 2 2 2 2 2 2 2 2 2 ...
$ Redirect : int 1 1 1 1 1 1 1 1 1 1 ...
$ on_mouseover : int 1 2 1 1 1 1 1 1 1 1 ...
$ RightClick : int 1 1 1 1 1 1 1 1 1 1 ...
$ popUpWidnow : int 1 2 1 1 1 1 1 1 2 1 ...
$ Iframe : int 1 2 1 1 1 1 1 1 2 1 ...
$ age_of_domain : int 3 1 1 1 3 3 1 1 1 1 ...
$ DNSRecord : int 2 1 1 2 1 2 1 2 2 1 ...
$ web_traffic : int 3 3 2 3 3 3 1 3 2 2 ...
$ Page_Rank : int 2 3 1 1 1 1 1 1 1 1 ...
$ Google_Index : int 1 1 1 1 1 1 1 1 1 1 ...
$ Links_pointing_to_page : int 2 1 3 2 1 2 1 3 2 2 ...
$ Statistical_report : int 2 1 2 2 2 2 2 2 2 2 ...
Co wszystko zrozumiałem, szukając tego błędu jest prawdziwe() nie może być stosowana do list. Nie mam pojęcia, co to jest REAL(). Z góry dziękuję !!
Próbowałaś konwersji danych do numerycznego jak sugeruje błąd 'pociąg [] <- lapply (train, as.numeric) ', a następnie użyj' xgb.DMatrix (data = data.matrix (train)) ' – user20650