emergence_read: Read a Stage-Structure Survey from a File or a Folder

View source: R/emergence_read.R

emergence_readR Documentation

Read a Stage-Structure Survey from a File or a Folder

Description

Reads one field survey of the population stage structure for emergence_calc: one row per stage, with a stage name column, a count (or percent) column and a days-to-eclosion column. The input may be a single csv file (delimiter auto-detected), a single xlsx/xls file (via the 'readxl' package) or a folder containing csv/xlsx files (batch mode; the files are combined and the source file name kept in a source_file column).

Usage

emergence_read(
  path,
  encoding = "UTF-8",
  header = TRUE,
  pattern = "\\.(csv|xlsx|xls)$"
)

Arguments

path

Path to a csv/xlsx file or to a folder (batch mode).

encoding

Text encoding of csv files, default "UTF-8". Use "GBK" for csv files saved from Chinese 'Excel' on 'Windows'.

header

Logical; whether the file(s) contain a header row. Default TRUE.

pattern

Regular expression selecting the files in batch mode; default: csv / xlsx / xls.

Value

A data.frame (single file), or the combined data.frame with an extra source_file column (folder input).

See Also

emergence_calc, emergence_analyze

Examples

f <- system.file("extdata", "emergence_example.csv",
                 package = "insectecol")
d <- emergence_read(f)
head(d)

insectecol documentation built on Oct. 5, 2026, 5:08 p.m.