Skip to contents

as_fnc_df() converts a data frame containing coordinates and functional charactertics in a morphological space to a fnc_df object for use in later funcitons, most importantly krige_surf.

Usage

as_fnc_df(x, func.names = NULL, scale = TRUE)

Arguments

x

a data frame containing coordinates and functional characteristics (and possibly other variables, which are ignored). The first two columns must correspond to the x and y coordinates of the warps in morphological space.

func.names

the names of the variables in x the correspond to functional characteristics. These charcteristics must be numeric variables. If NULL (the default), all variables other than the first two will be taken to be the functional characteristics under study.

scale

whether to scale the functional characteristics to have a minimum of 0 and a maximum of 1. This should generally be left at its default (TRUE) unless the variables have already been scaled.

Details

Input data can be from a sampled grid of locations in morphospace, measured specimen data, species or group means, or a mix.

Value

A fnc_df object, which is a data.frame with the x and y coordinates in the first two columns and the functional characteristics in the other columns. The "func.names"

attribute contains the names of the functional characteristics.

See also

as.data.frame

krige_surf for using an fnc_df object to create a kriged surface.

Examples

data("warps")

warps_fnc <- as_fnc_df(warps, 
                       func.names = c("hydro", "curve",
                                       "mech", "fea"))
                                       
str(warps_fnc)
#> Classes ‘fnc_df’ and 'data.frame':	24 obs. of  6 variables:
#>  $ x    : num  -0.189 -0.189 -0.189 -0.189 -0.134 ...
#>  $ y    : num  -0.05161 -0.00363 0.04435 0.09233 -0.05161 ...
#>  $ hydro: num  0.763 0.627 0.487 0.174 0.858 ...
#>  $ curve: num  0.0544 0 0.1045 0.281 0.1202 ...
#>  $ mech : num  0.359 0.473 0.446 0 0.149 ...
#>  $ fea  : num  0.372 0.458 0.512 0.65 0.777 ...
#>  - attr(*, "func.names")= chr [1:4] "hydro" "curve" "mech" "fea"