(new_record_raw <- c(5.3,3.2,2.0,0.2))
(new_record_mat <- matrix(new_record_raw,nrow = 1))
(new_record_dmat <- xgb.DMatrix(data = new_record_mat))
predict(xgb1,newdata=new_record_dmat)
or more concisely:
predict(xgb1,
newdata=xgb.DMatrix(data = matrix(c(5.3,3.2,2.0,0.2)
,nrow = 1)))