format | R Documentation |
Format and print objects of class "coords"
or "waypoints"
.
## S3 method for class 'coords'
print(x, ..., max = NULL)
## S3 method for class 'waypoints'
print(x, ..., max = NULL)
## S3 method for class 'coords'
format(x, ..., usenames = TRUE)
## S3 method for class 'waypoints'
format(x, ..., usenames = TRUE)
ll_headers(aswidth, fmt)
x |
object of class |
... |
further arguments passed to or from other methods. |
max |
numeric or |
usenames |
|
aswidth |
|
fmt |
|
The format()
methods for "coords"
and "waypoints"
objects
output elegantly formatted character
vector representations of their arguments, which are
used by their respective print()
methods.
Prior to formatting and printing, "coords"
or "waypoints"
objects are checked to
ensure that their "valid"
attribute (in the case of a "coords"
object), or
"validlat"
and "validlon"
attributes (in the case of a "waypoints"
object)
are present and all TRUE
i.e., valid. If these attributes are found to contain any
FALSE
i.e. invalid values, a warning is issued and similarly, if these attributes are
missing, a warning is issued and the objects are re-validated as described under
validate()
.
ll_headers()
outputs the headings "Latitude ... Longitude"
formatted to the
same width as argument aswidth
, adjusted for format fmt
and is primarily intended
for use by the print()
method for class "waypoints"
.
The format()
methods for both classes "coords"
and "waypoints"
return a
character
vector, respectively of length length(x)
or nrow(x)
, and
containing values formatted in decimal degrees, degrees and minutes, or degrees, minutes and
seconds as appropriate.
format()
, print()
,
"coords"
and "waypoints"
.
## Continuing example from `as_coords()`...
## Print named "coords" object in degrees and minutes,
## 'silently' using S3 print() method
dm
## Print explicitly using S3 print() method, specifying
## the maximal number of entries to be printed
print(dm, max = 14)
## Format as a fixed-width character vector,
## with names...
format(dm)
## ...or without them
format(dm, usenames = FALSE)
###
## Continuing example from `as_waypoints()`...
## Print named "waypoints" object in degrees and minutes,
## 'silently' using S3 print() method
wp
## Print explicitly using S3 print() method, specifying
## the maximal number of entries to be printed
print(wp, max = 21)
## Format as a fixed-width character vector,
## with names...
format(wp)
## ...or without them
format(wp, usenames = FALSE)
rm(dm, wp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.