Learn R Programming

mmodely (version 0.2.5)

interpolate: Interpolate missing data in a data frame

Description

This function finds NA values and interpolates using averaging values of nearby genus and species

Usage

interpolate(df, taxa=c('genus','family'), clmns=1:length(df))

Value

a modified data frame without missing values in the columns specified

Arguments

df

a data frame

taxa

a vector of taxonomic ranks (corresonding to columns) to assist in guiding the interpolating

clmns

the names of the columns to interpolate over

Examples

Run this code

path <- system.file("extdata","primate-example.data.csv", package="mmodely")
gs.tab <- read.csv(path, row.names=1)

clmns <- match(c('mass.Kg','DPL.km'),names(gs.tab))
df.2 <- interpolate(df=gs.tab, taxa='genus', clmns=clmns)

Run the code above in your browser using DataLab