Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

RandomForest error with R NAs introduced by coercion

Quiero aplicar RandomForest y me da como error lo siguiente:

tamano.total <- nrow(datos)
tamano.entreno <- round(tamano.total*0.7) # Asignamos el 70% de los datos totales para ENTRENAMIENTO
datos.indices <- sample(1:tamano.total , size=tamano.entreno)
datos.entreno <- datos[datos.indices,]    # Asignamos el 30% de los datos totales para PRUEBA
datos.test <- datos[-datos.indices,]
modeloRF <- randomForest(Indicador~., data=datos.entreno)
#Error in randomForest.default(m, y, ...) : 
#  NA/NaN/Inf in foreign function call (arg 1)
#In addition: Warning message:
#In data.matrix(x) : NAs introduced by coercion

head(datos,6)
   Nombre ID      Lat      Long Velocidad DistanciaKm DistanciaTotal Cantidad Indicador
1 Cecilia 15 -8.11422 -79.03720         0      20.000        4039.15        1     Comun
2 Cecilia 15 -8.09975 -79.06337         0      23.449       10991.19        1     Comun
3 Cecilia 15 -8.08161 -79.04833         0      23.275       13727.87        1     Comun
4 Cecilia 15 -8.08161 -79.04833         0      27.563       13652.96        1     Comun
5 Cecilia 15 -8.08160 -79.04836         0      24.818        8294.25        1     Comun
6 Cecilia 15 -8.08160 -79.04835         0      23.306        8327.06        1     Comun

Comments