lines.dfunc | R Documentation |
Lines method for objects of class 'dfunc
'. Distance
function line methods add distance functions to existing plots.
## S3 method for class 'dfunc'
lines(x, newdata = NULL, ...)
x |
An estimated distance function resulting from a call to
|
newdata |
Data frame similar to the |
... |
Parameters to |
A data frame containing the x and y coordinates of the plotted line(s) is returned invisibly.
dfuncEstim
, plot.dfunc
,
print.abund
set.seed(87654)
x <- rnorm(1000, mean=0, sd=20)
x <- x[x >= 0]
x <- units::set_units(x, "mi")
dfunc <- dfuncEstim(x~1, likelihood="halfnorm")
plot(dfunc, nbins = 40, col="lightgrey", border=NA, vertLines=FALSE)
lines(dfunc, col="grey", lwd=15)
lines(dfunc, col="black", lwd=5, lty = 2)
# Multiple lines
data(sparrowDetectionData)
data(sparrowSiteData)
dfuncObs <- dfuncEstim(formula = dist ~ observer
, likelihood = "halfnorm"
, detectionData = sparrowDetectionData
, siteData = sparrowSiteData)
plot(dfuncObs
, vertLines = FALSE
, lty = 0
, col = c("grey","lightgrey")
, border=NA
, main="Detection by observer"
, legend = FALSE)
y <- lines(dfuncObs
, newdata = data.frame(observer = levels(sparrowSiteData$observer))
, col = palette.colors(length(levels(sparrowSiteData$observer)))
, lty = 1
, lwd = 4)
head(y) # values returned, same as predict method
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.