Skip to content

convert a data frame with NULL to a list of integer

2 messages · kennyPA, jim holtman

#
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:
[1] 25352   173
[1] "data.frame"
[1] "data.frame"
30 31 32   33 34 35 36   37   38   39   40
NM_000014  1 14  1 NULL 27  8 21 NULL NULL NULL NULL
[1] NA NA NA NA NA NA NA NA NA NA NA
thanks a lot!

-Kenny
#
Exactly how do you want to convert it?  It looks like you have columns
that are not integers, but factors.  Can you provide an 'str' of the
dataframe so that we can see what the structure is.  Can you also
provide an idea of what you want as output; you say a multiple list of
integers, but I am not sure what you are expecting.  If you have
factors, some appear to be character data; how are those to be
handled?  A small subset of the data would be helpful.
On Fri, Jan 29, 2010 at 7:09 PM, kennyPA <tao_sf at yahoo.com> wrote: