readces: Read in CES data

View source: R/readces.R

readcesR Documentation

Read in CES data

Description

Reads in CES data from a text file in EuroCES format

Usage

readces(file, visits='std', group.race=TRUE, fix=FALSE, winter=FALSE, verbose=FALSE)
readBTO(file, species)

Arguments

file

A valid filename

visits

Either 'std' to include only standard (numbered up to 13) visits, 'all' to do no checking, or a (character) vector listing allowed visit identifiers.

group.race

Aggregate records of different races (i.e. those where the last digit of the Euring code is not zero)?

fix

Logical, should presumed errors be fixed? See details.

winter

Logical, if TRUE days will be numbered from July 1, and year will be adjusted downwards by 1 for visits in January to June, so Jan 1 1985 will become day 185 of 1984.

verbose

Logical, produce a file listing records with (currently species/age/sex) errors to be fixed?

species

A numeric Euring species code

Details

For details of the file specification see the CES pages of the Euring website, the function will attempt to match similar column names; a warning will be generated if it detects anything amiss (not guaranteed!). Some of these can be safely ignored (e.g. the 'surprising species' one) if everything appears to be in order.

The function does some basic error-checking and will try to give informative messages where it detects a problem. Where records are deleted or values set to NA (missing) a warning will be given. If fix=TRUE then the function will change records as follows: - sex of all encounters for an individual will be assigned the commonest sex recorded for that species (if the sex on encounter is recorded as unknown, or the other sex). - records aged as 3 in any year other than that of first encounter will be changed to 4. - sites with multiple coordinates will be be assigned their average location (across rows) - rows will be ordered by site, followed by year, visit, species and ring number where possible the function will indicate how many records have been fixed.

Value

A dataframe with (at a minimum) the following columns: countryID (where the scheme is), sitename(as referred by the scheme), site (a sequential numeric identifier), habitat, visit (number), day, month, year, netlength, ring, species, sex, age, race, julian (day), lat, long. Unrecognised columns in the datafile will be removed. Note, 'ring' will be a combination of scheme and ring, separated by an underscore ('_'), any '.' in the ring number will be removed.

Latitude and longitude are in decimal degrees (rounded to 3 d.p. which is ~ 0.1km, and always towards the south and west, i.e. the bottom-left of the grid cell). Race will usually be the same as species (i.e. a Euring number), unless particular races were identified in the data file (e.g. as for Motacilla alba alba/yarrelli, see group.race=). The column 'julian' gives the day of year from 1 Jan (including 29 Feb in leap years).

Note

The CES programs expect birds aged as either juvenile (3) or adult (4), the function will recode ages where it can, 2 is also allowed; records with other ages (0, 1) will be deleted. Expect some warnings, some are for information only - they do not necessarily indicate an error.

readBTO() is provided for reading in BTO '.all' fixed format files, variables not included in this format (eg habitat, NetLength) are simply set to NA.

Author(s)

Rob Robinson

References

Euring CES pages: https://euring.org/research/ces-europe/

Examples

## Not run: 
ukdata <- readces("d:/data/ces/ukdata.csv", fix=TRUE)

## End(Not run)

btorobrob/cesr documentation built on June 9, 2025, 5:39 a.m.