Skip to content
Back to formatted view

Raw Message

Message-ID: <1264810180635-1445595.post@n4.nabble.com>
Date: 2010-01-30T00:09:40Z
From: kennyPA
Subject: convert a data frame with NULL to a list of integer

I have a data frame with integers mixed with a lot of NULLs, how do I convert
that to multiple lists of integers with zero (to replace NULL)? I tried the
following, and they failed:

> dim(g2)
[1] 25352   173
> class(g2)
[1] "data.frame"
> class(g2[1,])
[1] "data.frame"
> g2[1,30:40]
          30 31 32   33 34 35 36   37   38   39   40
NM_000014  1 14  1 NULL 27  8 21 NULL NULL NULL NULL
> g3<-as.integer(g2[1,30:40])
> g3
 [1] NA NA NA NA NA NA NA NA NA NA NA
>

thanks a lot!

-Kenny
-- 
View this message in context: http://n4.nabble.com/convert-a-data-frame-with-NULL-to-a-list-of-integer-tp1445595p1445595.html
Sent from the R help mailing list archive at Nabble.com.