{"action":"opened","issue":{"url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment/issues/108","repository_url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment","labels_url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment/issues/108/labels{/name}","comments_url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment/issues/108/comments","events_url":"https://api.github.com/repos/vjcitn/MultiAssayExperiment/issues/108/events","html_url":"https://github.com/vjcitn/MultiAssayExperiment/issues/108","id":134581572,"number":108,"title":"Subsetting rows of MultiAssayExperiment by non-character i","user":{"login":"PeteHaitch","id":1049741,"avatar_url":"https://avatars.githubusercontent.com/u/1049741?v=3","gravatar_id":"","url":"https://api.github.com/users/PeteHaitch","html_url":"https://github.com/PeteHaitch","followers_url":"https://api.github.com/users/PeteHaitch/followers","following_url":"https://api.github.com/users/PeteHaitch/following{/other_user}","gists_url":"https://api.github.com/users/PeteHaitch/gists{/gist_id}","starred_url":"https://api.github.com/users/PeteHaitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PeteHaitch/subscriptions","organizations_url":"https://api.github.com/users/PeteHaitch/orgs","repos_url":"https://api.github.com/users/PeteHaitch/repos","events_url":"https://api.github.com/users/PeteHaitch/events{/privacy}","received_events_url":"https://api.github.com/users/PeteHaitch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-18T13:31:57Z","updated_at":"2016-02-18T13:31:57Z","closed_at":null,"body":"I think it's worth considering adding support for subsetting rows of MultiAssayExperiment by non-character `i`, specifically logical and numeric `i`. As I thought this through, I realised that this might require a bit more work than I'd first imagined, such as supporting `i` being a `list` or `List` (see below).\r\n\r\nHere is a use case where I see it could be useful to support non-character `i`. Suppose you want to subset by rows matching a regular expression. For example, to find all gene names beginning with \"CDKN\". A `list` index could be created using `lapply(rownames(MAE), function(x) {grep(\"^CDKN\", x, value = TRUE)})`. The user would then need to `unlist()` this to pass it as `i` in the subsetting operation. The two drawbacks I see here are:\r\n\r\n1. The user might be relying on some code that returns these matches as a logical or a numeric vector, e.g., where `value = FALSE` in the above `grep()` (perhaps indirectly called by the user buried within an exported function).\r\n2. Even when, like in the above, the operation returns an object containing only \"characters\" (or more formally in the form of a `S4Vectors::CharacterList`), the user is required to `unlist()` this prior to subsetting. \r\n\r\nThe second point makes me wonder whether `[,MultiAssayExperiment-method` needs to support `i` being a `list` or `List` of the appropriate length and having elements of the appropriate atomic type?\r\n\r\nThe other scenario I mentioned in the conference call where I imagine the need to subset by non-character `i` is to grab the first `n` rows of the MAE. As Levi pointed out, and which I hadn't considered, there is currently no real ordering of rows between assays, but I still imagine there might be scenarios where this might be desirable (for example, if the user constructed an ordering of rows between assays in their particular MAE object). There may also be a more formal ordering/linking of rows between assays in the work that Kasper and I are experimenting with.\r\n\r\nTo summarise, while in general I think a user _could_ construct the appropriate character vector from their numeric or logical vector or `list` or `List`, I think it would be great if the subsetting method natively supported as many of these scenarios as possible/reasonable."}}