I am trying to knit my rmarkdown file to .html, however rstudio freezes when I reach certain computation-heavy commands like difftime a distHaverstine.
trips_2 <- trips_1 %>%
mutate(
weekday = wday(started_at, label = T, abbr = F),
month = month(started_at, label = T, abbr =F),
week = strftime(started_at, format = "%V"),
day = day(started_at),
start_hour = hour(started_at),
trip_length = as.numeric(difftime(ended_at, started_at,units = "secs"))
or
may_to_october_behavior <- trips_w_stations %>%
filter(month == 'May'|
month == 'June'|
month == 'July'|
month == 'August'|
month == 'September'|
month == 'October') %>%
rowwise() %>%
mutate(trip_distance = distHaversine(c(start_lng, start_lat), c(end_lng, end_lat),
r=6378137)) %>%
filter(trip_distance > 0) %>%
group_by(customer_type, bike_type) %>%
summarize(mean_trip_length = mean(trip_length),
mean_distance_travelled_m = mean(trip_distance),
ride_count = n_distinct(ride_id)) %>%
mutate(avg_mph = (mean_distance_travelled_m/mean_trip_length)*2.2369)
Does anyone have any tips on how to solve this problem? My computer runs on Win10 and remains pretty beefy, which leads me to believe the issue may have to do with rstudio specifically.
In an attempt to lower the demand on the program, I have gone back and removed any dataframes that might clutter the environment, but even with the bare minimum data in my environment, I'm getting the same freeze issue.
Many thanks for any advice.