Thank you.

el


On 02/09/2021 00:41, Bill Dunlap wrote:
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 <nos...@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@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]]



--
To email me replace 'nospam' with 'el'

______________________________________________
R-help@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.

Reply via email to