which(grepl(....)) looks odd. Doesn't grep by itself return the correct vector of indices? Regards, Jorgen Harmse.? Message: 5 Date: Fri, 12 Jul 2024 17:42:05 +0800 From: Steven Yen <styen at ntu.edu.tw <mailto:styen at ntu.edu.tw>> To: Uwe Ligges <ligges at statistik.tu-dortmund.de <mailto:ligges at statistik.tu-dortmund.de>>, R-help Mailing List <r-help at r-project.org <mailto:r-help at r-project.org>> Cc: Steven Yen <syen04 at gmail.com <mailto:syen04 at gmail.com>> Subject: Re: [R] grep Message-ID: <b73784ce-c018-4587-bcd9-64adbd0dc4a7 at ntu.edu.tw <mailto:b73784ce-c018-4587-bcd9-64adbd0dc4a7 at ntu.edu.tw>> Content-Type: text/plain; charset="utf-8" Sorry. grepl worked: which(grepl("very|somewhat",names(goprobit.p$est)))