Learn R Programming

tapnet (version 0.3)

tapnet2df: Convert tapnet object into data.frame

Description

Function allows direct use of data prepared for tapnet analysis by other statistical methods, e.g. regression approaches

Usage

tapnet2df(tapnetObject)

Arguments

tapnetObject

results of applying fit_tapnet to the tapnet object;

Value

A data.frame containing network observations, PEMs, traits and abundances for regression-type analysis.

Details

This function simply puts all data into a data.frame, with each row an entry in the network matrix.

References

Benadi et al. in prep

Examples

Run this code
# NOT RUN {
ex <- simulate_tapnet(nlower=10, nhigher=50, ntraits_pem=3, ntraits_nopem=2, Nwebs = 3)
df <- tapnet2df(ex)
head(df)
# }
# NOT RUN {
  library(ranger)
  frf <- ranger(interactions ~ ., data=df[, -c(1:2)], importance="impurity")
  sort(importance(frf), decreasing=TRUE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab