% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/env_stack_transform.R
\name{env_stack_transform}
\alias{env_stack_transform}
\title{Coverts a list of 'SpatRaster' stacks where the elements are environmental
variables and the layers are depths to a list of SpatRaster stacks where the elements
are depths and the layers are environmental variables}
\usage{
env_stack_transform(envs_all, envs_names)
}
\arguments{
\item{envs_all}{a list of 'spatRaster' stacks where each element is a different
environmental variable and each layer is a depth slice.}

\item{envs_names}{A 'character' vector of the names of the environmental variables
to be applied to the layers of the resulting list of 'spatRaster' stacks}
}
\value{
A list of 'spatRaster' stacks where each list element is a depth slice and
each layer is an environmental variable.
}
\description{
A user will likely already have environmental data organized into a list
of 'spatRaster' stacks where each element is a different environmental variable and each
layer corresponds to a depth slice for background sampling and extracting. However, the
maxent_3D function requires the data be input as a list of 'spatRaster' stacks where
each element corresponds to a depth slice and each layer is an environmental variable
for the purpose of projecting the model back into geographic space, and this function
has been developed for ease of conversion.
}
\details{
The extents of each environmental variable layer should match on a depth slice
by depth slice basis.
}
\examples{
library(terra)

# creating a list of spatRaster stacks where each element is an environmental variable
# and each layer is a depth

env1_d1 <- rast(ncol = 50, nrow = 50)
values(env1_d1) <- sample(c(1:100), size = 2500, replace = TRUE)
env2_d1 <- rast(ncol = 50, nrow = 50)
values(env2_d1) <- sample(c(1:100), size = 2500, replace = TRUE)
env1_d2 <- rast(ncol = 50, nrow = 50)
values(env1_d2) <- sample(c(1:100), size = 2500, replace = TRUE)
env2_d2 <- rast(ncol = 50, nrow = 50)
values(env2_d2) <- sample(c(1:100), size = 2500, replace = TRUE)

env1 <- c(env1_d1, env1_d2)
env2 <- c(env2_d1, env2_d2)
envs <- list(env1, env2)
envnames <- c("env1", "env2")

# Here's the function
result <- env_stack_transform(envs_all = envs, envs_names = envnames)

}
\keyword{SpatRaster}
\keyword{list}
\keyword{stack}
\keyword{transform}
