@jmukhalian Justin, it's extremely helpful to have some representative data to go with the FAQ: What's a reproducible example (`reprex`) and how do I do one?
Without knowing the data type of habitat
and site
it's hard even to pose the question of what is meant by nesting
With some clarification, you'll find more people able to pitch in with helpful answers.
Aside: Don't think of R
as coding, think of it as algebra. Although there are some programming like features, most of the time you are just passing arguments to functions f(x) = y in R
is `y <- someFunction(one or more arguments).