juba / questionr

R package to make surveys processing easier
https://juba.github.io/questionr/
81 stars 17 forks source link

Problem with aggregate function after loading questionr #2

Closed volokhonsky closed 11 years ago

volokhonsky commented 11 years ago

After using questionr package i have problem with aggregate

tab1<-aggregate(form, data=aqm, FUN=function(x) c(mean =mean(x), s_d =sd(x)))

Error in eval(expr, envir, enclos) : can't find function "fapply"

After detach questionr the problem does not go away, needs restart R.

juba commented 11 years ago

Are you sure the problem comes from questionr ? I can't reproduce it here with the following aggregate example :

aggregate(state.x77, list(Region = state.region),FUN=function(x) c(mean =mean(x), s_d =sd(x)))
ghost commented 11 years ago

This comes from package:memisc and only applies to aggregate.formula. memisc has its own "improved" version of aggregate formula i.e. aggregate(y ~ x, data = foo, FUN = mean) becomes aggregate(mean(y) ~ x, data = foo). I'm not sure why it persists after detaching memisc... Anyways, it is not a problem with questionr or really a bug for that matter. Although it is really annoying that someone would change a function like aggregate in their package

juba commented 11 years ago

Thanks @volokhonsky for reporting, and thanks @jlburkhead for tracking and pointing out this issue.