Budding ecologist here learning how to use R studio in data analysis. I'm research bison movements in the GYE to show where they cross highways - the data was stored on google looker studio after being transferred from old home-baked software. There are two types of sightings - static sightings and ones with a start and stop that show movement.
I need to isolate the rows that have start and stop data from the static ones in R, but the issue is that both static and start-stop rows have beginning and end linestring pathway data ( Ex: "LINESTRING(-111.097913 44.776748, -111.097813 44.776748)" ) - the static rows just have a negligible difference of 0.0001° for the longitude specifically, whereas the rows that show actual movement it's much greater. The latitude is consistent for static rows.
Is there a function that can separate row data based on the disparity between the two linestring longitude data points? I am a novice at R, taking lessons/exercises to build my skills so I'm not sure where to start for a function like this, but it seems possible. Any help is greatly appreciated!
I tried to create vectors with concatenated information based on the "LINESTRING" column, using subset(), but I couldn't find a way to isolate the data based on this kind of rule.
I would use
sf::st_distance()between start/stop points orsf::st_length()on linestrings itself, like:and filter out those 'static' like:
Created on 2024-03-04 with reprex v2.1.0