topZtest: Applies Z-test

View source: R/top_ztest.R

topZtestR Documentation

Applies Z-test

Description

This function applies a Z-test.

Usage

topZtest(strings, countries, polygon, ...)

Arguments

strings

character string with a regular expression to be tested.

countries

character string vector with country designations (names or ISO-codes).

polygon

data frame. Defines the polygon for comparison with the remainder of a country (or countries).

...

Additional parameter:

  • feat.class character string vector. Selects data only of those feature classes (check http://download.geonames.org/export/dump/readme.txt for the list of all feature classes). By default, it is P.

  • toponym_path character string. Path name for downloaded data.

Details

This function lets users apply a Z-test (two proportion test), comparing the frequency of a given string in a polygon to the frequency in the rest of the country. Parameter countries accepts all designations found in country(query = "country table"). Polygons passed through the polygon parameter need to intersect or be within a country specified by the countries parameter. Parameter toponym_path accepts "pkgdir" for the package directory or a full, alternative path. With toponymOptions(), users can specify the path for toponym and map data downloaded by this package across sessions. See help(toponymOptions). The data used is downloaded by getData() and is accessible on the GeoNames download server.

Value

An object of class htest containing the results.

Examples

## We recommend setting a persistent path for downloaded data by using toponymOptions()
## Users can always set the path manually when a function is used
## For illustration purposes,
## 1. the path is manually set each time
## 2. and wrapped in donttest because data will be downloaded in the following example:

topZtest("thorpe$",
         "GB",
         toponym::danelaw_polygon,
         toponym_path = tempdir())
## returns an object of class htest containing the results.


toponym documentation built on April 13, 2026, 5:06 p.m.