Re: [R] ISO Code for Namibia ('NA')

2021-09-02 Thread Dr Eberhard Lisse

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

1 NANamibia
2 NZNew Zealand
3   ?

subset(z, Code=="NA")

# A tibble: 1 x 2
   Code  Name

1 NANamibia

subset(z, is.na(Code))

# A tibble: 1 x 2
   Code  Name

1   ?

subset(z, Code==NA_character_)

# A tibble: 0 x 2
# ... with 2 variables: Code , Name 

On Wed, Sep 1, 2021 at 3:33 PM Dr Eberhard Lisse  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

  1 NC
[...]
 10 NZ

but should look like

 # A tibble: 10 × 1
location_code

  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.


Re: [R] ISO Code for Namibia ('NA')

2021-09-01 Thread Bill Dunlap
> z <- tibble(Code=c("NA","NZ",NA), Name=c("Namibia","New Zealand","?"))
> z
# A tibble: 3 x 2
  Code  Name
   
1 NANamibia
2 NZNew Zealand
3   ?
> subset(z, Code=="NA")
# A tibble: 1 x 2
  Code  Name
   
1 NANamibia
> subset(z, is.na(Code))
# A tibble: 1 x 2
  Code  Name
   
1   ?
> subset(z, Code==NA_character_)
# A tibble: 0 x 2
# ... with 2 variables: Code , Name 

On Wed, Sep 1, 2021 at 3:33 PM Dr Eberhard Lisse  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
>
>  1 NC
> [...]
> 10 NZ
>
> but should look like
>
> # A tibble: 10 × 1
>location_code
>
>  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]]

__
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.


[R] ISO Code for Namibia ('NA')

2021-09-01 Thread Dr Eberhard Lisse

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
   
 1 NC
[...]
10 NZ

but should look like

# A tibble: 10 × 1
   location_code
   
 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.