Issue facetting time series plots from nested lists


I am trying to plot the time series seismic data from a data frame. In the df I have nested 1 minute long segments of the time series data in the columns sac_EV and and sac_NO. I would like to facet them by their unique ID which corresponds to which microphone the event was recorded at and what time it was recorded at that microphone. This is stored in the column trace_name. I thought this was straight forward but I haven't been able to get it working yet.


Sorry, but I haven't seen a better way to get RDS data up on this forum beyond providing a link to my GIT repo for download. I would have tried to provide it as a csv, but the nested columns don't appear to translate to csv formatting. Bonus points to anyone who can show me how to do this better.

Data downloadable from GitLab here.

Attempted Code

#insert path to where RDS data was downloaded
STEAD_data <- readr::read_rds("")

ggplot2::ggplot() +
  ggplot2::geom_line(ggplot2::aes(x = 1:6000, y = unlist(STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$sac_EV))) +
  ggplot2::geom_vline(xintercept = STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$rand_window*STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$sampling_rate, color = "red") +
  ggplot2::geom_vline(xintercept = (STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$sac_s_index - (STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$sac_p_index)), color = "orange") +
  ggplot2::geom_vline(xintercept = (STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$sac_coda_index - STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$sac_p_index + STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$rand_window*STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$sampling_rate), color = "blue") +
  ggplot2::geom_hline(yintercept = mean(unlist(STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$sac_EV)), color = "green") +
  ggplot2::facet_wrap(facets = STEAD_data[which(STEAD_data$receiver_code == "MNHN"),]$trace_name)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.