Thanks Josh for the guidance. Here's the modified function that produces what I'm looking for:
avg.ang <- function(x, ...){
if (sum(is.na(x))==length(x)) {
NA
} else {
round(mean.circular(circular(x, units="degrees", rotation="clock",
zero=pi/2, modulo="2pi"), na.rm=TRUE))
}
}
The na.rm=TRUE
is the key. The if/else statement is to deal with occurrences where all cells=NA (otherwise breaks with an error). If anyone has a more elegant way to deal with the if/else, I'm all ears.