[R] ISO Code for Namibia ('NA')
    Bill Dunlap 
    w||||@mwdun|@p @end|ng |rom gm@||@com
       
    Thu Sep  2 00:41:16 CEST 2021
    
    
  
> z <- tibble(Code=c("NA","NZ",NA), Name=c("Namibia","New Zealand","?"))
> z
# A tibble: 3 x 2
  Code  Name
  <chr> <chr>
1 NA    Namibia
2 NZ    New Zealand
3 <NA>  ?
> subset(z, Code=="NA")
# A tibble: 1 x 2
  Code  Name
  <chr> <chr>
1 NA    Namibia
> subset(z, is.na(Code))
# A tibble: 1 x 2
  Code  Name
  <chr> <chr>
1 <NA>  ?
> subset(z, Code==NA_character_)
# A tibble: 0 x 2
# ... with 2 variables: Code <chr>, Name <chr>
On Wed, Sep 1, 2021 at 3:33 PM Dr Eberhard Lisse <nospam using lisse.na> wrote:
> Hi,
>
> how can I look for the ISO code for Namibia 'NA' in a list of ISO codes
> which looks something like
>
>         # A tibble: 10 × 1
>            location_code
>            <chr>
>          1 NC
> [...]
>         10 NZ
>
> but should look like
>
>         # A tibble: 10 × 1
>            location_code
>            <chr>
>          1 NA
>          2 NC
> [...]
>         11 NZ
>
> In other words 'NA' is taken for the missing value NA.
>
> greetings, el
>
> ______________________________________________
> R-help using 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.
>
	[[alternative HTML version deleted]]
    
    
More information about the R-help
mailing list