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

View File Source Download File No help file available

Function: ispt.inside

Function Description: ispt.inside

Check a single pt (x and y) against a large number of quadrats whose corners are given by the rows of coord, xlo, ylo, xhi, yhi. It returns the fraction of quadrats which the point falls inside. This is exactly like are.ptsinside() but allows there to be many rectangles, defined by a dataframe coord.

Function Arguments:

ArgumentDefault Value
pt
coord

Function Source:

ispt.inside=function(pt,coord)
{
norect=dim(coord)[1]
inside=logical()

for(i in 1:norect) logical[i]=are.ptsinside(pt,drp(coord[i,]))

return(inside)
# lowerx=coord[,1]# upperx=coord[,3]>=pt[1]
# lowery=coord[,2]# uppery=coord[,4]>=pt[2]

# covered=length(which(lowerx & upperx & lowery & uppery))

# return(covered/dim(coord)[1])
}