Return a list of sf_POINTS or a data.frame from a sftraj object

pts_traj(traj, sfc = FALSE)

coord_traj(traj)

Arguments

traj

a trajectory geometery from sf_traj

sfc

TRUE/FALSE should the return by an sfc or a list of points. Defaults to FALSE

Examples

print(racc_traj, 10, 5)
#> sftraj (*steps*) with 445 features and 10 fields #> geometry: "geometry" (XY, CRS: WGS 84) #> timestamps: "timestamp" (integer) #> groupings: "sft_group" (*id*, *month*) #> ------------------------------- #> animal_id latitude longitude height hdop ... sft_group #> 1 TTP-058 NA NA NA 0.0 ... (id: TTP-058, month: 1) #> 2 TTP-058 26.06945 -80.27906 7 6.2 ... (id: TTP-058, month: 1) #> 3 TTP-058 NA NA NA 0.0 ... (id: TTP-058, month: 1) #> 4 TTP-058 NA NA NA 0.0 ... (id: TTP-058, month: 1) #> 5 TTP-058 26.06769 -80.27431 858 5.1 ... (id: TTP-058, month: 1) #> 6 TTP-058 26.06867 -80.27930 350 1.9 ... (id: TTP-058, month: 1) #> 7 TTP-058 26.06962 -80.27908 11 2.3 ... (id: TTP-058, month: 1) #> 8 TTP-058 26.06963 -80.27902 9 2.7 ... (id: TTP-058, month: 1) #> 9 TTP-058 NA NA NA 0.0 ... (id: TTP-058, month: 1) #> 10 TTP-058 26.06982 -80.27900 NA 2.0 ... (id: TTP-058, month: 1) #> geometry timestamp #> 1 POINT EMPTY (2019-01-18 19:02:30 --> 2019-01-18 20:02:30) #> 2 POINT (-80.27906 26.06945) (2019-01-18 20:02:30 --> 2019-01-18 21:02:30) #> 3 POINT EMPTY (2019-01-18 21:02:30 --> 2019-01-18 22:02:30) #> 4 POINT EMPTY (2019-01-18 22:02:30 --> 2019-01-18 23:02:30) #> 5 LINESTRING (-80.27431 26.06... (2019-01-18 23:02:30 --> 2019-01-19 00:02:30) #> 6 LINESTRING (-80.2793 26.068... (2019-01-19 00:02:30 --> 2019-01-19 01:02:30) #> 7 LINESTRING (-80.27908 26.06... (2019-01-19 01:02:30 --> 2019-01-19 02:02:04) #> 8 POINT (-80.27902 26.06963) (2019-01-19 02:02:04 --> 2019-01-19 03:02:30) #> 9 POINT EMPTY (2019-01-19 03:02:30 --> 2019-01-19 12:02:30) #> 10 LINESTRING (-80.279 26.0698... (2019-01-19 12:02:30 --> 2019-01-19 13:02:05)
# extract a list of points pts_traj(racc_traj)[1:10]
#> [[1]]
#> POINT EMPTY
#> #> [[2]]
#> POINT (-80.27906 26.06945)
#> #> [[3]]
#> POINT EMPTY
#> #> [[4]]
#> POINT EMPTY
#> #> [[5]]
#> POINT (-80.27431 26.06769)
#> #> [[6]]
#> POINT (-80.2793 26.06867)
#> #> [[7]]
#> POINT (-80.27908 26.06962)
#> #> [[8]]
#> POINT (-80.27902 26.06963)
#> #> [[9]]
#> POINT EMPTY
#> #> [[10]]
#> POINT (-80.279 26.06982)
#>
# or a data.frame of points coord_traj(racc_traj)[1:10]
#> [1] NA -80.27906 NA NA -80.27431 -80.27930 -80.27908 #> [8] -80.27902 NA -80.27900