View source: R/find_countrycol.R
find_countrycol | R Documentation |
This function takes a data frame as argument and returns the column name (or index) of all columns containing country names.
It can be used to automate the search of country columns in data frames.
For the purpose of this function, a country is any of the 249 territories designated in the ISO standard 3166
.
On large datasets a random sample is used for evaluating the columns.
find_countrycol(
x,
return_index = FALSE,
allow_NA = TRUE,
min_share = 0.6,
sample_size = 1000
)
x |
A data frame object |
return_index |
A logical value indicating whether the function should return the index of country columns instead of the column names. Default is |
allow_NA |
Logical value indicating whether columns containing |
min_share |
A value between |
sample_size |
Either |
Returns a vector of country names (return_index=FALSE
) or column indices (return_index=TRUE
) of columns containing country names.
is_country, country_name, find_keycol, find_timecol
find_countrycol(x=data.frame(a=c("Brésil","Tonga","FRA"), b=c(1,2,3)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.