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: parallel.line

Function Description: parallel.line

Finds the slope and intercept of the line parallel to a line whose slope and intercept are given, through the points x,y. Note that the intercept is not needed. For any m that are infinite, the intercept is x.

Function Arguments:

ArgumentDefault Value
b
m
x
y

Function Source:

parallel.line=function(b,m,x,y)
{
minf=is.infinite(m)

len=IfElse(length(b)>length(x),length(b),length(x))

if(length(m)==1) slope=rep(m,len)
else slope=m

inter=y-m*x
inter[minf]=x

result=data.frame(b=inter,m=slope)

return(result)
}