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 point x,y. Note that the intercept is not needed. The is.infinite check is necessary for vertical lines.Function Arguments:
| Argument | Default Value |
|---|---|
| b | |
| m | |
| x | |
| y |
Function Source:
parallel.line=function(b,m,x,y)
{
if(is.infinite(m)) return(data.frame(b=x,m=Inf))
intercept=y-m*x
result=data.frame(b=intercept,m=rep(m,length(intercept)))
return(result)
}
{
if(is.infinite(m)) return(data.frame(b=x,m=Inf))
intercept=y-m*x
result=data.frame(b=intercept,m=rep(m,length(intercept)))
return(result)
}