[R] where are these NAs coming from?

Sam Steingold sds at gnu.org
Wed Sep 19 20:35:24 CEST 2012


> * jim holtman <wubygzna at tznvy.pbz> [2012-09-19 13:58:08 -0400]:
>
> At least provide a reproducible example by creating the problem with a
> subset of 'z' and 'mycountry'

if I knew how to reproduce the problem, I would have known what was going on.

> Could something like this be happening?

precisely, thanks!

>> x <- data.frame(country = 1:5, language = 1:5)
>> mycountry <- NA
>> z <- x[x$country == mycountry,]
>> z
>      country language
> NA        NA       NA
> NA.1      NA       NA
> NA.2      NA       NA
> NA.3      NA       NA
> NA.4      NA       NA
>
>
> On Wed, Sep 19, 2012 at 1:50 PM, Sam Steingold <sds at gnu.org> wrote:
>> I see this:
>> --8<---------------cut here---------------start------------->8---
>>> length(which(is.na(z$language)))
>> [1] 0
>>> locals <- z[z$country == mycountry,]
>>> length(which(is.na(locals$language)))
>> [1] 229
>> --8<---------------cut here---------------end--------------->8---
>> where are those locals without the language coming from?!
>>
>> --
>> Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
>> http://www.childpsy.net/ http://ffii.org http://honestreporting.com
>> http://camera.org http://www.memritv.org http://dhimmi.com
>> I don't like cats! -- Come on, you just don't know how to cook them!
>>
>> ______________________________________________
>> 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.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://ffii.org http://camera.org http://jihadwatch.org
http://americancensorship.org http://mideasttruth.com
Independence: nobody pays for you.  Liberty: nobody thinks for you.




More information about the R-help mailing list