[R] how to ignore NA with "NA" or "NULL"

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Wed Jun 6 14:37:25 CEST 2012


Please read the posting guide mentioned at the bottom of every message.

You might also benefit from reading http://stackoverflow.com/questions/5963269/how-to-make-a-great-reproducible-example. We would certainly benefit from not having to guess what problems you are really encountering.

Also, it seems that you refer to in-memory data as "files"... this is imprecise and confusing. Learn to use the str() function to know what kinds of objects you are referring to... in this case I believe you are referring to data frames.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

jeff6868 <geoffrey_klein at etu.u-bourgogne.fr> wrote:

>Hello,
>
>I added your flags in my code but there are still errors.
>Actually I tried some things:
>
>- in function "na.fill", I changed: 
>if(all(!is.na(y[1:8700,1])))  return(NA)  to
>if(all(!is.finite(y[1:8700,1])))  return(y) 
>In order to have this file unchanged.
>
>It has removed my dimension problem. I don't have errors anymore in:
> refill <- process.all(lst, corhiver2008capt1) but  just some "message
>d'avis" readable with warnings()
>
>Then I noticed in "refill" (the object which should be filled with my
>code)
>that files containing only NAs are turned as NULL in this object. So I
>have
>0 rows for these objects instead of having them unchanged (35000 rows).
>So when I transform it to data.frame, it doesn't work because of a new
>dimension problem due to these NULL files.
>
>But I don't understand where these files have been turned as NULL in my
>code. Could you maybe tell me how can I have in output my "only NA
>files"
>not as NULL but kept unchanged like at the beginning?
>Thanks again.
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/how-to-ignore-NA-with-NA-or-NULL-tp4632287p4632506.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>R-help at r-project.org mailing list
>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.



More information about the R-help mailing list