REAL() kann nur angewendet werden, um eine 'numerische', nicht ein 'integer'

Obwohl die Frage scheint zu sein, zu duplizieren, ich bin dieses posting, als nicht von Ihnen gab eine Lösung und relevant für mein problem.

dtrain<-xgb.DMatrix(data=data.matrix(train),label=data[t,c(31)])

Fehler in xgb.DMatrix(Daten = Daten.matrix(Zug), label = data[t, c(31)]) :
REAL() kann nur angewendet werden, um eine 'numerische', nicht ein 'integer'

> 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 ...

Alle was ich verstanden habe durch die Suche dieser Fehler ist REAL() nicht angewendet werden können, um Listen. Ich bin ratlos, was ist dieses REAL - ().
Vielen Dank im Voraus!!

haben Sie versuchen, konvertieren Sie Ihre Daten in numerischen als der Fehler deutet train[] <- lapply(train, as.numeric), und verwenden Sie dann xgb.DMatrix(data=data.matrix(train))

InformationsquelleAutor Shankar Pandala | 2015-11-24

Schreibe einen Kommentar