% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/schema.R
\name{link}
\alias{link}
\title{Define a link between a fact table and a dimension table}
\usage{
link(key, node)
}
\arguments{
\item{key}{A character vector or named character vector specifying join keys.
Unnamed: same column name in both tables. Named: \code{c("fact_col" = "dim_col")}.}

\item{node}{A \code{vectra_node} object (the dimension table). Must be file-backed
(created via \code{\link[=tbl]{tbl()}}, \code{\link[=tbl_csv]{tbl_csv()}}, or \code{\link[=tbl_sqlite]{tbl_sqlite()}}).}
}
\value{
A \code{vectra_link} object.
}
\description{
Creates a link descriptor that specifies how to join a dimension table
to a fact table via one or more key columns.
}
\examples{
\donttest{
f_obs <- tempfile(fileext = ".vtr")
f_sp  <- tempfile(fileext = ".vtr")
write_vtr(data.frame(sp_id = 1:3, value = c(10, 20, 30)), f_obs)
write_vtr(data.frame(sp_id = 1:3, name = c("A", "B", "C")), f_sp)
lnk <- link("sp_id", tbl(f_sp))
unlink(c(f_obs, f_sp))
}

}
