I've got a table such as this:
structure(list(Suggested.Symbol = c("CCT4", "DHRS2", "PMS2",
"FARSB", "RPL31", "ASNS"), gwas_p.onset = c(0.9378, 0.5983, 7.674e-10,
0.09781, 0.5495, 0.7841), gwas_p.dc14 = c(0.3975, 0.3707, 6.117e-17,
0.2975, 0.4443, 0.7661), gwas_p.tfc6 = c(0.2078, 0.896, 7.388e-19,
0.5896, 0.3043, 0.6696), gwas_p.tms30 = c(0.5724, 0.3409, 4.594e-13,
0.2403, 0.1357, 0.3422)), row.names = c(NA, 6L), class = "data.frame")
I can find the minimum value in certain columns by name like so:
df <- df %>%
mutate(p.min = pmin(p_onset, p_dc14))
However, how would I find the pmin of all columns with names matching a certain pattern, e.g. column names starting "gwas_p"??