# trajectory data
= read.table("https://github.com/GretaTimaite/pedestrian_simulation/releases/download/data/traj.txt",
traj1 col.names = c("ID", "FR", "X", "Y", "Z", "A", "B", "ANGLE", "COLOR"))
|> dplyr::glimpse()
traj1
# clean GCS data
= read.csv("https://github.com/GretaTimaite/pedestrian_simulation/releases/download/data/frames_final.csv") gcs
2 Getting data
GCS data was cleaned by Patricia Ternes. It was downloaded from here. However, the data was not in a friendly format (multiple .dar files sorted by frame), thus I further manipulated and transformed the data into a .csv format. Final GCS data used throughout this project can be downloaded from the releases.
In this chapter I do not demonstrate the CGS data transformation from .dat to a .csv file. Yet, the script for it (including extensive documentation) can be found in the “read_frames.R” script.
JPS produces .txt files that can be easily read into R. It did not require any pre-processing before reading it into R.
Also, both JPS and GCS datasets are transformed into sf
objects to make spatial manipulation possible (and much easier!).
# let's convert jps and gcs dataframes to sf objects, so we can perform spatial operations
= traj1 |>
traj1_sf ::st_as_sf(coords = c("X", "Y")) |>
sf::select(-c(3,4,5,6,7)) # drop columns we won't need
dplyr
= gcs |>
gcs_sf ::st_as_sf(coords = c("x_coord", "y_coord")) |>
sf::mutate(geometry = geometry/14) # convert from pixels to metres dplyr