>>> I just hoped that there was a way to follow what R uses internally to
format R code.

I have to throw in a caution about using R's formatting.  It is often
misleading.
Here's one example:

> as.matrix.default
function (x, ...)
{
    if (is.matrix(x))
        x
    else array(x, c(length(x), 1L), if (!is.null(names(x)))
        list(names(x), NULL)
    else NULL)
}
<environment: namespace:base>

This formatting suggests that the structure is:

if(condition)
  result1
else if(condition)
  result2
else
  result3

Better would be:

function (x, ...)
{
  if (is.matrix(x))
    x
  else
    array(x, c(length(x), 1L),
          if (!is.null(names(x)))
            list(names(x), NULL)
          else
            NULL)
}

	[[alternative HTML version deleted]]

