{"action":"created","issue":{"url":"https://api.github.com/repos/vegandevs/vegan/issues/144","labels_url":"https://api.github.com/repos/vegandevs/vegan/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/vegandevs/vegan/issues/144/comments","events_url":"https://api.github.com/repos/vegandevs/vegan/issues/144/events","html_url":"https://github.com/vegandevs/vegan/issues/144","id":109789071,"number":144,"title":"behaviour of rrarefy()","user":{"login":"FabianRoger","id":5137092,"avatar_url":"https://avatars.githubusercontent.com/u/5137092?v=3","gravatar_id":"","url":"https://api.github.com/users/FabianRoger","html_url":"https://github.com/FabianRoger","followers_url":"https://api.github.com/users/FabianRoger/followers","following_url":"https://api.github.com/users/FabianRoger/following{/other_user}","gists_url":"https://api.github.com/users/FabianRoger/gists{/gist_id}","starred_url":"https://api.github.com/users/FabianRoger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FabianRoger/subscriptions","organizations_url":"https://api.github.com/users/FabianRoger/orgs","repos_url":"https://api.github.com/users/FabianRoger/repos","events_url":"https://api.github.com/users/FabianRoger/events{/privacy}","received_events_url":"https://api.github.com/users/FabianRoger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-10-05T12:50:08Z","updated_at":"2015-10-08T05:56:03Z","closed_at":null,"body":"Hello,\r\n\r\nI use ```vegane::rarefy``` to rarefy my community datasets. Because I have a lot of samples and and the sampling depth (it's sequencing data) is quite uneven, I choose to rarefy at depth X and exclude samples with N < X. \r\n\r\nhowever, the function attempts to rarefy each community and throws the error ```cannot take a sample larger than the population when replace = FALSE```\r\n\r\nTherefore I always have to manually exclude those samples first. I was wondering if it wouldn't be possible to handle this internally? i.e exclude all samples with N < X and issue a warning along the lines of ```WARNING: the following samples had less counts than the chosen rarefaction depth and where therefore excluded from the dataset: sample[1], sample[6] (...)```\r\n\r\nIf you agree that this behaviour would be desirable, I could also rewrite the function and submit it as a pull request. \r\n\r\nthanks for providing this great resource!\r\n\r\nbest\r\n\r\nFabian\r\n"},"comment":{"url":"https://api.github.com/repos/vegandevs/vegan/issues/comments/146427981","html_url":"https://github.com/vegandevs/vegan/issues/144#issuecomment-146427981","issue_url":"https://api.github.com/repos/vegandevs/vegan/issues/144","id":146427981,"user":{"login":"jarioksa","id":1432933,"avatar_url":"https://avatars.githubusercontent.com/u/1432933?v=3","gravatar_id":"","url":"https://api.github.com/users/jarioksa","html_url":"https://github.com/jarioksa","followers_url":"https://api.github.com/users/jarioksa/followers","following_url":"https://api.github.com/users/jarioksa/following{/other_user}","gists_url":"https://api.github.com/users/jarioksa/gists{/gist_id}","starred_url":"https://api.github.com/users/jarioksa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarioksa/subscriptions","organizations_url":"https://api.github.com/users/jarioksa/orgs","repos_url":"https://api.github.com/users/jarioksa/repos","events_url":"https://api.github.com/users/jarioksa/events{/privacy}","received_events_url":"https://api.github.com/users/jarioksa/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T05:56:03Z","updated_at":"2015-10-08T05:56:03Z","body":"PR #145 addresses this issue. It is based on the minimal change where `rrarefy` will work when `sample` > population and return the non-rarefied community with a warning. Along with this, `drarefy` will also issue a warning in this case. After this `rarefy`, `drarefy` and `rrarefy` behave consistently.\r\n\r\nI won't implement the fix of f5ff44b: no **vegan** function should work so that random rows are removed in  `x <- foo(x)`. If you want to have this behaviour, you can use your own wrapper function:\r\n```R\r\nrrarewithdrop <- \r\n    function(x, sample) \r\n{\r\n    rrarefy(x[rowSums(x) >= sample, , drop = FALSE], sample)\r\n}\r\n```"}}