{"action":"created","issue":{"url":"https://api.github.com/repos/DjalmaPessoa/convey/issues/28","labels_url":"https://api.github.com/repos/DjalmaPessoa/convey/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/DjalmaPessoa/convey/issues/28/comments","events_url":"https://api.github.com/repos/DjalmaPessoa/convey/issues/28/events","html_url":"https://github.com/DjalmaPessoa/convey/issues/28","id":113408160,"number":28,"title":"dynamic statements do not currently work inside any of the functions","user":{"login":"ajdamico","id":216807,"avatar_url":"https://avatars.githubusercontent.com/u/216807?v=3","gravatar_id":"","url":"https://api.github.com/users/ajdamico","html_url":"https://github.com/ajdamico","followers_url":"https://api.github.com/users/ajdamico/followers","following_url":"https://api.github.com/users/ajdamico/following{/other_user}","gists_url":"https://api.github.com/users/ajdamico/gists{/gist_id}","starred_url":"https://api.github.com/users/ajdamico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajdamico/subscriptions","organizations_url":"https://api.github.com/users/ajdamico/orgs","repos_url":"https://api.github.com/users/ajdamico/repos","events_url":"https://api.github.com/users/ajdamico/events{/privacy}","received_events_url":"https://api.github.com/users/ajdamico/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-10-26T17:30:37Z","updated_at":"2015-10-26T20:08:19Z","closed_at":null,"body":"the way that you are slimming the data.frame object inside of all of the functions down to only the variables for the current computation will not work if the variable is constructed on-the-fly.\r\n\r\nhere is a reproducible example that produces the bug.  notice the as.numeric() causes the problem.  this should work if we are going to align with the survey package\r\n\r\n\tlibrary(convey)\r\n\tlibrary(survey)\r\n\tlibrary(vardpoor)\r\n\tdata(eusilc)\r\n\r\n\t# linearized design\r\n\r\n\tdes_eusilc <- svydesign( ids = ~rb030 , strata = ~db040 ,  weights = ~rb050 , data = eusilc )\r\n\tdes_eusilc <- convey_prep( des_eusilc )\r\n\r\n\t# works\r\n\tsvyarpt( ~eqIncome , design = des_eusilc )\r\n\t# breaks\r\n\tsvyarpt( ~as.numeric(eqIncome) , design = des_eusilc )\r\n\r\n\t\r\nyou can view the point that this breaks by typing\r\n\r\n\tdebug(convey:::svyarpt.survey.design)\r\n\r\nhere are the lines leading up the error\r\n\t\r\n\tBrowse[2]> \r\n\tdebug: inc <- terms.formula(formula)[[2]]\r\n\tBrowse[2]> \r\n\tdebug: df <- model.frame(design)\r\n\tBrowse[2]> \r\n\tdebug: incvar <- df[[as.character(inc)]]\r\n\tBrowse[2]> \r\n\tError in .subset2(x, i, exact = exact) : no such index at level 1\r\n\r\n\r\nlook at the code inside\r\n\r\n\tsurvey:::svymean.survey.design\r\n\t\r\nand also\r\n\t\r\n\tsurvey:::svymean.survey.design2\r\n\r\nfor ideas about how to work around this issue?\r\n"},"comment":{"url":"https://api.github.com/repos/DjalmaPessoa/convey/issues/comments/151268154","html_url":"https://github.com/DjalmaPessoa/convey/issues/28#issuecomment-151268154","issue_url":"https://api.github.com/repos/DjalmaPessoa/convey/issues/28","id":151268154,"user":{"login":"DjalmaPessoa","id":5308071,"avatar_url":"https://avatars.githubusercontent.com/u/5308071?v=3","gravatar_id":"","url":"https://api.github.com/users/DjalmaPessoa","html_url":"https://github.com/DjalmaPessoa","followers_url":"https://api.github.com/users/DjalmaPessoa/followers","following_url":"https://api.github.com/users/DjalmaPessoa/following{/other_user}","gists_url":"https://api.github.com/users/DjalmaPessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/DjalmaPessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DjalmaPessoa/subscriptions","organizations_url":"https://api.github.com/users/DjalmaPessoa/orgs","repos_url":"https://api.github.com/users/DjalmaPessoa/repos","events_url":"https://api.github.com/users/DjalmaPessoa/events{/privacy}","received_events_url":"https://api.github.com/users/DjalmaPessoa/received_events","type":"User","site_admin":false},"created_at":"2015-10-26T20:08:18Z","updated_at":"2015-10-26T20:08:18Z","body":"Ok, I'll try to implement the first alternative.\n\n> Em 26/10/2015, às 18:04, Anthony Damico <notifications@github.com> escreveu:\n> \n> i think: this will be a lot of work for you to get it working, users often\n> get the wrong answer, and the use cases you're presenting probably have\n> straightforward alternatives?\n> \n> On Mon, Oct 26, 2015 at 4:00 PM, DjalmaPessoa <notifications@github.com>\n> wrote:\n> \n> > consider:\n> > data(api)\n> > dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)\n> > vcov(svymean(~api00+api99,dclus1))\n> >\n> >\n> > On Mon, Oct 26, 2015 at 5:52 PM, Djalma Pessoa <pessoad@gmail.com> wrote:\n> >\n> > > What I meant was\n> > > cov(mean(var1), mean(var2))\n> > >\n> > >\n> > > On Mon, Oct 26, 2015 at 5:46 PM, Anthony Damico <\n> > notifications@github.com>\n> > > wrote:\n> > >\n> > >> but cov( svymean(var1) , svymean(var2) ) isn't really much more typing?\n> > >>\n> > >> —\n> > >> Reply to this email directly or view it on GitHub\n> > >> <\n> > https://github.com/DjalmaPessoa/convey/issues/28#issuecomment-151262580>\n> > >> .\n> > >>\n> > >\n> > >\n> >\n> > —\n> > Reply to this email directly or view it on GitHub\n> > <https://github.com/DjalmaPessoa/convey/issues/28#issuecomment-151266260>.\n> >\n> —\n> Reply to this email directly or view it on GitHub.\n> \n"}}