Kyle Kulinski
Kyle Kulinski

Reputation: 21

Best method of visualizing starting latitude / longitude to ending latitude / longitude (distance traveled) in R

The goal of the project is to determine how far casual riders travel vs. membership riders and have a visual graphic that supports the data conclusions.

I have plotted the maps using mapviewer and ggplot of start and end points. I would like to see which type of rider is traveling further and what routes they are taking. Below is the scipt I used for the first portions. Any insight into tracking information of how bikes traveled and from what start / end points would be immensely helpful. Thanks in advance

Best,

Kyle


mapview(testmap, map.types = "Stamen.Toner", zcol = "member_casual")

    ggplot(A202004.divvy.tripdata, aes(end_lat, end_lng, col=member_casual)) + geom_point() + ggtitle("end clustering")
    
```set.seed(55)
cluster.A202004.divvy.tripdata <- kmeans(A202004.divvy.tripdata[,11:12], 3, nstart = 20)
cluster.A202004.divvy.tripdata
table(cluster.A202004.divvy.tripdata$cluster, A202004.divvy.tripdata$member_casual)
ggplot(A202004.divvy.tripdata, aes(end_lat, end_lng, color=member_casual, shape=cluster.A202004.divvy.tripdata$cluster)) + geom_point() + ggtitle("A202004 Cluster Plot")

A sample set of data is included here. I'm just looking for potential steps in the right direction.

https://docs.google.com/spreadsheets/d/1VpIwNKK6uvK90rstTQbLNi-auzV-Z79hbpx3wJjdrzM/edit?usp=sharing

start clustering

end clustering

mapviewer

I've done the legwork of getting the data cleaned and inputted, but I haven't been able to find a tool that could draw lines between start_lng, start_lat, and end_lng, end_lat data points. Ideally I'd want to change the colors of the lines based on the length of the ride or other parameters such as trip length.

Upvotes: 0

Views: 303

Answers (0)

Related Questions