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/utilitiesCTFS.r

View File Source Download File No help file available

Function: unidentified.species

Function Description: unidentified.species

Takes a string of species names or codes and returns a logical vector indicating with TRUE those that should be excluded. Any species name (code) matching precisely the names in exactstr are excluded, as well as any which has characters matching partialstr. Either or both exactstr and partialstr can be NULL. The typical use if for excluding species whose codes or names indicate they are not fully identified. It returns a logical vector which is TRUE for those to be excluded. This was formerly in utilities.r.

Function Arguments:

ArgumentDefault Value
spnames
exactstrc('UNIDEN','UNID','uniden','unid')
partialstrc('XX','**')

Function Source:


unidentified.species=function(spnames,exactstr=c('UNIDEN','UNID','uniden','unid'),partialstr=c('XX',
        '**')) {
remove=numeric()
unidname=rep(FALSE,length(spnames))

if(is.null(exactstr) & is.null(partialstr)) return(unidname)

for(i in 1:length(partialstr))
remove=c(remove,grep(partialstr[i],spnames,fixed=TRUE))

for(i in 1:length(exactstr))
remove=c(remove,which(spnames==exactstr[i]))

unidname[remove]=TRUE
unidname[is.na(spnames)]=TRUE
return(unidname)
}