% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/matchDim.R
\name{matchDim}
\alias{matchDim}
\title{Match dimensions of a magpie object to those of a reference object}
\usage{
matchDim(x, ref, dim = 1:3, fill = NA)
}
\arguments{
\item{x}{A \code{magpie} object to be modified.}

\item{ref}{A \code{magpie} object used as a reference for the modification.
Returns \code{x} if \code{ref} is \code{NULL}.}

\item{dim}{Subset of dimensions for which the matching should be done.  Can
be either a number between 1 and 3 or a vector of these.  Defaults to all
dimensions (i.e. \code{1:3}).}

\item{fill}{Value to be set in new dimensions.}
}
\value{
The modified \code{magpie} object.
}
\description{
A helper that restricts and expands a magpie object \code{x} to the size of a
magpie object \code{ref}.  Dimension names not present in \code{x} are added and set to
the value provided by \code{fill}.  Dimension names not present in \code{ref} are
cropped.
}
\seealso{
Other DataBinding: 
\code{\link{cbind.magpie}()},
\code{\link{extend}()},
\code{\link{magpie_expand}()},
\code{\link{magpiesort}()},
\code{\link{mbind}()}
}
\author{
Falk Benke
}
\concept{DataBinding}
