scanpp | R Documentation |
Reads a point pattern dataset from a text file.
scanpp(filename, window, header=TRUE, dir="", factor.marks=NULL, ...)
filename |
String name of the file containing the coordinates of the points in the point pattern, and their marks if any. |
window |
Window for the point pattern. An object of class |
header |
Logical flag indicating whether the first line of the
file contains headings for the columns.
Passed to |
dir |
String containing the path name of the directory
in which |
factor.marks |
Logical vector (or NULL) indicating whether marks are to be
interpreted as factors. Defaults to |
... |
Ignored. |
This simple function reads a point pattern dataset from a file containing the cartesian coordinates of its points, and optionally the mark values for these points.
The file identified by filename
in directory dir
should be a text file that can be read using read.table
.
Thus, each line of the file (except possibly the first line)
contains data for one point in the
point pattern. Data are arranged in columns. There should be either
two columns (for an unmarked point pattern) or more columns (for a
marked point pattern).
If header=FALSE
then the first two columns of data
will be interpreted as the x
and y
coordinates
of points. Remaining columns, if present, will be interpreted as
containing the marks for these points.
If header=TRUE
then the first line of the file should contain
string names for each of the columns of data. If there are columns
named x
and y
then these will be taken as the
cartesian coordinates, and any remaining columns will be taken as
the marks. If there are no columns named x
and y
then the first and second columns will be taken as the cartesian
coordinates.
If a logical vector is provided for factor.marks
the length
should equal the number of mark columns (a shorter factor.marks
is recycled to this length). This vector is then used to determine
which mark columns should be interpreted as factors. Note: Strings will
not be interpreted as factors if the corresponding entry in
factor.marks
is FALSE
.
Note that there is intentionally no default for window
.
The window of observation should be specified.
If you really need to estimate the window, use the
Ripley-Rasson estimator ripras
.
A point pattern (an object of class "ppp"
,
see ppp.object
).
and \rolf.
ppp.object
,
ppp
,
as.ppp
,
ripras
## files installed with spatstat, for demonstration
d <- system.file("rawdata", "finpines", package="spatstat.data")
if(nzchar(d)) {
W <- owin(c(-5,5), c(-8,2))
X <- scanpp("finpines.txt", dir=d, window=W)
print(X)
}
d <- system.file("rawdata", "amacrine", package="spatstat.data")
if(nzchar(d)) {
W <- owin(c(0, 1060/662), c(0, 1))
Y <- scanpp("amacrine.txt", dir=d, window=W, factor.marks=TRUE)
print(Y)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.