read.morphodata: Data Input and Description

Description Usage Arguments Details Value See Also Examples

View source: R/read.morphodata.R

Description

This function imports data and produces a morphodata object from it.

Usage

1
2
3
4
5
6
7
8
9
read.morphodata(file, dec = ".", sep = "\t", ...)

## S3 method for class 'morphodata'

samples(object)

populations(object)

taxa(object)

Arguments

file

the file which the data are to be read from or a connection for reading (e.g., "clipboard").

dec

the character used for decimal points.

sep

the column separator character.

object

an object of class morphodata.

...

further arguments to be passed to read.table function.

Details

The function expects the following data structure:
(1) the first row contains variable names;
(2) the following rows contains individuals, single individual per row;
(3) the first three columns include unique identifiers for individuals, populations and taxa/groups, respectively. Columns have to be named as “ID”, “Population” and “Taxon”;
(4) starting from the fourth column, any number of quantitative or binary morphological characters may be recorded. Any variable names can be used (avoiding spaces and special characters);

If there are missing values in the data, they must be represented as empty cells or by the text NA, not zero, space or any other character. Example dataset in txt and xlsx formats are stored in the “extdata” directory of the MorphoTools2 package installation directory. To find the path to the package location run system.file("extdata", package = "MorphoTools2").

Value

an object of class morphodata with the following elements:

ID

IDs of each row of data object.

Population

population membership of each row of data object.

Taxon

taxon membership of each row of data object.

data

data.frame of individuals (rows) and values of measured morphological characters (columns).

See Also

characters

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data = read.morphodata(file = system.file("extdata", "centaurea.txt",
    package = "MorphoTools2"), dec = ".", sep = "\t")

data = read.morphodata(file = "morphodata.txt", dec = ".", sep = "\t")

data = read.morphodata("clipboard")

summary(data)
samples(data)
populations(data)
taxa(data)

MorphoTools2 documentation built on Dec. 11, 2021, 9:55 a.m.