Though question seems to be duplicate, i'm posting this as non of them gave a solution and relevant to my problem.
dtrain<-xgb.DMatrix(data=data.matrix(train),label=data[t,c(31)])
Error in xgb.DMatrix(data = data.matrix(train), label = data[t, c(31)]) : REAL() can only be applied to a 'numeric', not a '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 ...
What all I understood by searching this error is REAL() cannot be applied to lists. I am clueless what is this REAL(). Thanks in advance!!
The error states that xgb.DMatrix
takes numeric values, where the data were integers.
To convert the data to numeric use
train[] <- lapply(train, as.numeric)
and then use
xgb.DMatrix(data=data.matrix(train))