Learn R Programming

rvkstat (version 3.2.0)

vkGetDbRegions: Regions list.

Description

Get regions dictionary.

Usage

vkGetDbRegions(
    country_id,
    q = NULL,
    username     = getOption("rvkstat.username"),
    api_version  = getOption("rvkstat.api_version"),
    token_path   = vkTokenPath(),
    access_token = getOption("rvkstat.access_token")
)

Arguments

country_id

country identifier obtained using the vkGetDbCountries function.

q

search query string. For example, Len. The maximum string length is 15 characters.

username

Your vkontakte login.

api_version

Vkontakte API version.

token_path

Path to dir with credentials

access_token

API access tokens obtained using vkAuth or vkGetToken functions

Value

Data frame contains community statistics with the following values:

1. region_id

region identifier.

2. title

name of the region.

Details

If the q parameter is not specified, then a list of all regions in the given country will be returned. If the q parameter is specified, a list of regions that are relevant to the search query will be returned.

References

Documentation for API method database.getRegions: https://vk.com/dev/database.getRegions

Examples

Run this code
# NOT RUN {
## auth
my_tok <- vkAuth(app_id = 1, 
                 app_secret = "H2Pk8htyFD8024mZaPHm")

## Get a list of regions for Ukraine, because Ukraine id = 2
vk_regions  <- vkGetDbRegions(country_id = 2,
                              access_token = my_tok$access_token)

##get a list of cities of Ukraine on request "Ode"
vk_regions_search  <- vkGetDbRegions(country_id = 2,
                                     q = "Ode",
                                     access_token = my_tok$access_token)


# }

Run the code above in your browser using DataLab