[R] NAs introduced by coercion

Manish MAHESHWARI manishm at dbs.com
Fri Jan 8 09:35:45 CET 2016


Hi,

In glmnet, while using a matrix as an input, I get an error of NA's introduced by coercion. However in the input there is no NA value.

cvfit = cv.glmnet( x = mat1, y = train$response,family="multinomial", type.multinomial = "grouped", parallel = TRUE)
Error in lognet(x, is.sparse, ix, jx, y, weights, offset, alpha, nobs,  :
  NA/NaN/Inf in foreign function call (arg 5)
In addition: Warning message:
In lognet(x, is.sparse, ix, jx, y, weights, offset, alpha, nobs,  :
  NAs introduced by coercion

> anyisna = function(x) {any(is.na(x))}

> nas = apply(mat1, MARGIN = 2, FUN = anyisna)



> nas[nas==T]

named logical(0)



> any(is.na(train$response))

[1] FALSE


Can you pls throw some light on where is the NA found.

Thanks,
Manish

CONFIDENTIAL NOTE:
The information contained in this email is intended only...{{dropped:11}}



More information about the R-help mailing list