Topic: Utilities

Topic Description:

Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.



File: utilities/utilities.r

View File Source Download File No help file available

Function: which.maxNAs

Function Description: which.maxNAs

An unfortunate bug in which.max: if all elements are NA, it doesn't return anything. This means that for any vector, which.max returns a vector of length 1 unless all are NAs. This is a silly error, since a program expecting an element of length 1 falls apart otherwise.

Function Arguments:

ArgumentDefault Value
v

Function Source:

which.maxNAs=function(v)
{
if(length(which(!is.na(v)))==0) return(NA)
return(which.max(v))
}