Yes, Timothy, the request was not seen by all of us as the same. Indeed if the request was to show a subset of the original data consisting of only the rows that were the minimum for each Code and also showed ties, then the solution is a tad more complex. I would then do something along the lines of what others showed such as generating another column showing the minimum for each row and then showing only rows that matched their value in two columns or whatever was needed.
As noted, keeping the output in a specific order was not initially requested. Keeping the data in some order is a common enough request but in this situation, I suspect the order many might want would be the one showing the minimums in order, not the codes in the original order. -----Original Message----- From: Ebert,Timothy Aaron <teb...@ufl.edu> Sent: Thursday, August 25, 2022 11:59 AM To: avi.e.gr...@gmail.com Cc: R-help@r-project.org Subject: RE: [R] Getting minimum value of a column according a factor column of a dataframe My assumption (maybe wrong) was that we needed to keep the other variables. I want to find the values of Y, M, D, N, and O for the minimum value of Q within each unique value of Code, keeping the data in the original order. All one need to do is filter Q in the original dataframe by your answer for minQ. Keeping the data in the original order seems unnecessary, but that is what was asked in a later post. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.