GOAL
I am trying to edit some data I have and though it seems super straight forward, the condition in my logical statements seem to always be defaulting to false. This should be really simple but I cant seem to get the function to recognize which rows have 200 for the value in sampling_rate and then change the value of other corresponding columns. Any and all help is appreciated.
Data
https://gitlab.com/Bryanrt-geophys/sac2eqtransformr/-/raw/master/sample_data/https://gitlab.com/Bryanrt-geophys/sac2eqtransformr/-/raw/master/sample_data/pre_hdf5_unnested_filtered.rds
I still haven't heard of a good way to share RDS files so I just plug this into my browser and it downloads the file.
REPREX
pre_hdf5_filtered <- pre_hdf5_unnested_filtered %>%
nest(sac_EV = sac_EV) %>%
mutate(
sac_p_index = if_else(sampling_rate == 200, sac_p_index/2, sac_p_index),
sac_s_index = if_else(sampling_rate == 200, sac_s_index/2, sac_s_index),
sac_coda_index = if_else(sampling_rate == 200, sac_coda_index/2, sac_coda_index),
sac_index_end = if_else(sampling_rate == 200, sac_index_end/2, sac_index_end),
sampling_rate = if_else(sampling_rate == 200, 100, 100)
)
No idea why this always defaults to false.