Learn R Programming

mefa (version 1.1-4)

fill.count: Replace 'NA' Values

Description

This function replaces NA values according to the last non-NA value in a given column of a table.

Usage

fill.count(table)

Arguments

table
a matrix or data frame.

Value

  • A result is a matrix or data frame according to class of table.

Details

It is easy and convinient way to fill up values in a data table with non-redundant entries, eg. leaving empty spaces just like on a sheet of a notebook. By this function, such objects can be directly used in subsequent operations, eg. by function sscount.

See Also

sscount

Examples

Run this code
### Example 1: simple atrificial data

ss <- data.frame(
cbind(
c("sample1",NA,"sample2",NA,"sample3","sample4"),
c("species1",NA,"species1","species2","species3","zero.count"),
c("male","female","male","female","male","male")
),
c(1, 2, 10, 3, 4, 1)
)
colnames(ss) <- c("sample.id", "species.id", "gender", "catch")

ss

fill.count(ss)

sscount(fill.count(ss), zc="zero.count") ## equivalent as
sscount(ss, zc="zero.count", fill=TRUE)

### Example 2: field data of the dolina

data(dol.count)

dol.count

fill.count(dol.count)

Run the code above in your browser using DataLab