random_countries {countries}R Documentation

Output random country names

Description

This function returns the mode of vectors. That is to say, for any given vector of values, it returns the value that appears most frequently. The function works with strings, numerical and mixed inputs. NA values are treated as distinct values.

Usage

random_countries(n, replace = FALSE, nomenclature = "name_en", seed = NULL)

Arguments

n

Number of desired (pseudo)random country names.

replace

Logical value indicating whether sampling should be with replacement.

nomenclature

Nomenclature from which the list of countries should be taken. Not all countries are present in all nomenclature, for example Taiwan is not recognised by the UN, so it will not be returned with "WTO_en". The function accept any of the nomenclatures of country_name. For a list of accepted values, refer to this page. The default is name_en, which is the English list of names in the ISO standard 3166.

seed

Single numerical value to be used as seed.

Value

A vector of n (pseudo)random country names.

See Also

list_countries, country_name

Examples

random_countries(10)
random_countries(n = 500, replace = TRUE)
random_countries(n = 5, nomenclature = "ISO3", seed = 5)

[Package countries version 1.2.0 Index]