Learn R Programming

paleotree (version 2.5)

occData2timeList: Converting Occurrences Data to a timeList Data Object

Description

This function converts occurrence data, given as a list where each element is a different taxon's occurrence table (containing minimum and maximum ages for each occurrence), to the 'timeList' format, consisting of a list composed of a matrix of lower and upper age bounds for intervals, and a second matrix recording the interval in which taxa first and last occur in the given dataset.

Usage

occData2timeList(occList, intervalType = "dateRange")

Arguments

occList
A list where every element is a table of occurrence data for a different taxon, such as that returned by taxonSortPBDBocc. The occurrence data can be either a two-column matrix composed of the lo
intervalType
Must be either "dateRange" (the default), "occRange" or "zoneOverlap". Please see details below.

Value

Details

This function should translate taxon-sorted occurrence data, which could be Paleobiology Database datasets sorted by taxonSortPBDBocc or any data object where occurrence data (i.e. age bounds for each occurrence) for different taxa is separated into different elements of a named list. The argument intervalType{ The argument intervalType controls the algorithm used for obtain first and last interval bounds for each taxon, of which there are several to select from:intervalType [object Object],[object Object],[object Object] }

See Also

taxonSortPBDBocc, plotOccData and the example graptolite dataset at graptPBDB

Examples

Run this code
data(graptPBDB)

graptOccSpecies<-taxonSortPBDBocc(graptOccPBDB,rank="species",onlyFormal=FALSE)
graptTimeSpecies<-occData2timeList(occList=graptOccSpecies)

head(graptTimeSpecies[[1]])
head(graptTimeSpecies[[2]])

graptOccGenus<-taxonSortPBDBocc(graptOccPBDB,rank="genus",onlyFormal=FALSE)
graptTimeGenus<-occData2timeList(occList=graptOccGenus)

layout(1:2)
taxicDivDisc(graptTimeSpecies)
taxicDivDisc(graptTimeGenus)

# the default interval calculation is "dateRange"
# let's compare to the other option, "occRange"
	# for species

graptOccRange<-occData2timeList(occList=graptOccSpecies, intervalType="occRange")

#we would expect no change in the diversity curve
	#because there are only changes in th
		#earliest bound for the FAD
		#latest bound for the LAD
#so if we are depicting ranges within maximal bounds
	#dateRanges has no effect
layout(1:2)
taxicDivDisc(graptTimeSpecies)
taxicDivDisc(graptOccRange)
#yep, identical

#so how much uncertainty was gained by using dateRange?

# write a simple function for getting uncertainty in first and last
		# appearance dates from a timeList object
sumAgeUncert<-function(timeList){
	fourDate<-timeList2fourDate(timeList)
	perOcc<-(fourDate[,1]-fourDate[,2])+(fourDate[,3]-fourDate[,4])
	sum(perOcc)
	}

#total amount of uncertainty in occRange dataset
sumAgeUncert(graptOccRange)
#total amount of uncertainty in dateRange dataset
sumAgeUncert(graptTimeSpecies)
#the difference
sumAgeUncert(graptOccRange)-sumAgeUncert(graptTimeSpecies)
#as a proportion
1-(sumAgeUncert(graptTimeSpecies)/sumAgeUncert(graptOccRange))

#a different way of doing it
dateChange<-timeList2fourDate(graptTimeSpecies)-timeList2fourDate(graptOccRange)
apply(dateChange,2,sum)
#total amount of uncertainty removed by dateRange algorithm
sum(abs(dateChange))

layout(1)

Run the code above in your browser using DataLab