Description Usage Arguments Details Value Author(s) References See Also Examples
asPgtraj
populates a pgtraj
schema from the data provided
in relocations_table
. If the provided schema doesn't exist, it will
be created. On successful data input, asPgtraj
creates two database
views for each new pgtraj. These views are named parameters_<pgtraj_name>,
step_geometry_<pgtraj_name> and described in more detail in the package
vignette.
1 2 3 4 |
conn |
Connection object created with RPostgreSQL |
relocations_table |
String. Name of the schema and table that stores the relocations, e.g. c("schema","relocations") |
schema |
String. Name of the schema that stores or will store the pgtraj data model (Default = "traj"). |
pgtrajs |
String. Name of the pgtraj or name of the field that stores the pgtraj names. |
animals |
String. Name of the animal or name of the field that stores the animal names. |
bursts |
String. (Optional) name of the burst or name of the field that stores the burst names. If not given, each animal will have one burst. |
relocations |
String. Name of the field that contains the relocations
in relocations_table. Relocations can be provided either as columns names
containing X,Y coordinates (e.g., |
timestamps |
String. Name of the field in relocations_table that contains the timestamps. If NULL, Type I trajectory is assumed. |
rids |
String. Name of the field in relocations_table that contains
the numeric IDs of relocations. If |
srid |
Integer. Optional SRID (spatial reference ID) of (x,y) coordinates provided for relocations. Ignored if relocations is a geometry type. |
tzone |
String. Time zone specification for the timestamps column. If not specified, the database server time zone will be used (usually the server's local time zone). |
note |
String. Comment on the pgtraj. The comment is only used in the database and not transferred into the ltraj. |
clauses |
character, additional SQL to append to modify data
selected from relocations_table. Must begin with |
info_cols |
String. Optional character vector of database table
column names storing additional information on relocations
(replicating "infolocs" from the |
info_table |
Character vector of |
info_rids |
String. Column name of unique integer ID in |
Opening and closing PostgreSQL connections have to be done manually by the user. However, the function checks if the provided connection is still valid.
Note that the arguments pgtrajs
, animals
, bursts
, and
note
can refer to either a column name in relocations_table
,
or a string value. If the value is a column name, the values for the corresponding
attribute (e.g., animals
) will be the values from that column.
When providing a string value, the value will be applied to that attribute for
the entire pgtraj
.
Burst names must be unique across a pgtraj. If it is not desired to further
subset individual animal trajectories, leave bursts = NULL
,
in which case burst names will be equal to the animal name.
The time zone of the pgtraj is set to the local time zone of the user.
TRUE on success
Balázs Dukai balazs.dukai@gmail.com
David Bucklin dbucklin@ufl.edu
https://CRAN.R-project.org/package=adehabitatLT/vignettes/adehabitatLT.pdf
Section on pgtraj data model in the package vignette.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
asPgtraj(conn,
relocations_table = c("example_data","relocations_plus"),
pgtrajs = "id",
animals = "animal",
bursts = "burst",
relocations = "geom",
timestamps = "time",
rids = "gid",
note = "trajectories in 2015",
clauses = "WHERE extract(year FROM acquisition_time) = 2015",
info_cols = c("dist_to_road","land_cover","error_class")
)
## End(Not run)
## Not run:
asPgtraj(conn,
relocations_table = c("example_data","relocations_plus"),
schema = "traj_t4",
pgtrajs = "id",
animals = "animal",
bursts = "burst",
relocations = c("x","y"),
timestamps = "time",
rids = "gid")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.