I am attempting to knit my markdown file to html, however the process hangs on certain computation-heavy code chunks, leading to either my computer totally freezing, or a complete shutdown of my computer.
I am running the newest version of rstudio (64-bit 4.2.2) and per a recommendation in another forum, I chose to render using software instead of desktop on launch.
I'm currently going through my markdown file and using the rm() command to keep my environment as bare-bones as possible, but I continue to run into issues when running computation-heavy commands.
Is this a common problem? Additionally, what information can I provide to help the community guide me towards an answer?
For reference, I'm working with a dataframe that includes about 5.5 million records and running commands like the following:
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)
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"))