Hi Manish,
Most likely there are one or more negative numbers in mat1.

Jim


On Fri, Jan 8, 2016 at 7:35 PM, Manish MAHESHWARI <mani...@dbs.com> wrote:

> 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 on...{{dropped:13}}

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to