df2table: Convert data.frame and table to each other.

View source: R/convert.R

df2tableR Documentation

Convert data.frame and table to each other.

Description

Convert data.frame and table to each other.

Usage

df2table(df, st = "stand", sp = "species", ab = "abundance")

table2df(tbl, st = "stand", sp = "species", ab = "abundance")

dist2df(dist)

Arguments

df

A data.frame.

st, sp, ab

A string.

tbl

A table. community matrix. rownames: stands. colnames: species.

dist

A distance table.

Value

df2table() return table, 
table2df() return data.frame,
dist2df() return data.frame.

Examples

tibble::tibble(
   st = paste0("st_", rep(1:2, times = 2)), 
   sp = paste0("sp_", rep(1:2, each = 2)), 
   ab = runif(4)) %>%
  dplyr::bind_rows(., .) %>%
  print() %>%
  df2table("st", "sp", "ab")


ecan documentation built on July 9, 2023, 5:13 p.m.