On Fri, Sep 11, 2015 at 04:42:07PM +0200, peter dalgaard wrote: > Or change the data format slightly and use indexing: > > > l > key val > [1,] "1.1" "10000" > [2,] "1.9" "10000" > [3,] "1.4" "15000" > [4,] "1.5" "20000" > [5,] "1.15" "25000" > > v <- l[,2] > > names(v) <- l[,1] > > x <- c("1.9", "1.9", "1.1", "1.1", "1.4", "1.4", "1.5", "1.5", "1.5", > + "1.5") > > v[x] > 1.9 1.9 1.1 1.1 1.4 1.4 1.5 1.5 1.5 > 1.5 > "10000" "10000" "10000" "10000" "15000" "15000" "20000" "20000" "20000" > "20000" > > > ...
Yeah -- *that* is actually what I was trying to accomplish; thank you for the help! (Not to detract from Bert's suggestion -- that also works. But Peter's is what I had been trying to accomplish before I gave in & sent my plea.) [This is actually a part of a function I'm cobbling up to filter data.frames by values of a given column, where the acceptable bounds for the values can vary depending on the contents of a different column. E.g., we might expect certain "performance-related" metrics to have different ranges of interest for different classes of hardware.] And the function appears to be working so far (though I'll be poking and prodding it a bit yet). Peace, david -- David H. Wolfskill r...@catwhisker.org Those who would murder in the name of God or prophet are blasphemous cowards. See http://www.catwhisker.org/~david/publickey.gpg for my public key.
pgpbzS6WIRUz2.pgp
Description: PGP signature
______________________________________________ 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.