-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RE: ezANOVA return error message "....is not a variable in the data frame provided" #32
Comments
I agree that it would be nice, if variable input was possible. For now, this 'hack' may save you from copypasta. |
Thanks crsh for your comments. I have found a better solution but not sure whether it would affect the calculation results or not in general. At least the results are correct in my case. As I described, ezANOVA 3.0.0 was working for variable inputs and the superficial difference between 4.1.1 and 3.0.0 in ezANOVA function is the piece of codes for argument check as I copied in the above. I downloaded the source codes, commented them out, rebuild the package, and re-installed the package. It worked perfectly and gave the same results as version 3.0.0 did. Since the error was thrown when calling ezANOVA_main function which is defined as internal and is not directly exposed to any end-user calls, I would suggest that the argument check codes be moved into ezANOVA_main function where the inputs get immediate uses after validation. Not only does this give a unique location for finding the error, but importantly this would save tons of lines of codes if ezANOVA_main function has to be called in many places in a package or project, in other words, you don't need to copy the argument check codes in front of every time this function gets called. Hope this would help. |
+1 Any good analysis script needs to be able to call ezANOVA with variable arguments. |
I don't get it. I wanted to use ezANOVA for repeated measures (because I read it was supposed to be easy, and I'm a R beginner) and so I did something like:
The data looks like this: How am I even supposed to use ezANOVA?! I don't know how to get it to read my data! |
You don't need to put the rframe$ bits before each variable name, and you Let me know if you encounter any further troubles. Mike Mike Lawrence ~ Certainty is (possibly) folly ~ On Thu, Jan 28, 2016 at 9:07 PM, Vaquero84 [email protected] wrote:
|
Hello, I have the same problem as @Vaquero84. I'm also a R beginner and the ezANOVA function gives me the same error. This is my ANOVA: ANOVAghq <- ezANOVA(data=complete.cases(dataforanova), dv=.(ghq), wid=.(TN), between=.(schuljahr), within=.(Messzeitpunkte), type=3, detailed=T) This is the error I get: Error in ezANOVA_main(data = data, dv = dv, wid = wid, within = within, : "ghq" is not a variable in the data frame provided. And this is how I get the table for the ANOVA: dataforanova <- melt(data, id=c("TN", "schuljahr"), measured=c("ghq.1", "ghq.2", "ghq.3")) I don't know how to put my data here. But if I look at it with View(dataforanova), there is the variable ghq. Still ezANOVA doesn't find it. What is wrong? Can anyone help me, please? @Vaquero84 did you solve the problem? Maybe I made a really silly mistake and don't get it, because I'm just learning R. Thanks a lot!! |
Any news on this ? Why can't we set the arguments that call for column names as variables ? |
I suspect that what folks are trying to achieve here might be solved by
using tidy evaluation:
https://www.rstudio.com/resources/webinars/tidy-eval/
But it's really a sufficiently advanced use case that I'm not going to
devote any time to it myself. Feel free to submit a pull request if you
come up with any solutions yourself.
…--
Mike Lawrence
Graduate Student
Department of Psychology & Neuroscience
Dalhousie University
~ Certainty is (possibly) folly ~
On Mon, Mar 12, 2018 at 7:30 AM, Georgios Mavropalias < ***@***.***> wrote:
Any news on this ? Why can't we set the arguments that call for column
names as variables ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#32 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJM_XV10oLC8Ls10WGkij81mH89XzXcks5tdk5cgaJpZM4ATnkI>
.
|
ezANOVA version 4 or later does not accept variable inputs for its function parameters. Here is the procedure to reproduce the bug:
Example 1:
library(ez)
data(ANT)
var = .(rt)
rt_anova = ezANOVA(
data = ANT[ANT$error==0,]
, dv = var
, wid = subnum
, within = .(cue,flank)
, between = group
)
Error in ezANOVA_main(data = data, dv = dv, wid = wid, within = within, :
"var" is not a variable in the data frame provided.
Example 2:
library(ez)
data(ANT)
var = .(subnum)
rt_anova = ezANOVA(
data = ANT[ANT$error==0,]
, dv = rt
, wid = var
, within = .(cue,flank)
, between = group
)
Error in ezANOVA_main(data = data, dv = dv, wid = wid, within = within, :
"var" is not a variable in the data frame provided.
This can be tested for any of ezANOVA's input parameters with the same error.
The reason I call it a BUG is that, for example, if I have multiple columns of dependent variables needed to be tested, a loop over the names of multiple dependent variables is the convenient way to get it done efficiently, in particular when the number of dependent variables is large, for example, more than 50,000 in my case and their names are literally diverse and different.
However, ezANOVA verison 3 or earlier did work for variable inputs. I have looked at the codes between version 4 and 3 and found that the following piece of codes for argument check in ezANOVA function of version 4 or later cause the problem:
args_to_check = c('dv','wid','within','between','observed','diff','within_full','within_covariates','between_covariates')
args = as.list(match.call()[-1])
for(i in 1:length(args)){
arg_name = names(args)[i]
if(arg_name%in%args_to_check){
if(is.symbol(args[[i]])){
code = paste(arg_name,'=.(',as.character(args[[i]]),')',sep='')
eval(parse(text=code))
}else{
if(is.language(args[[i]])){
arg_vals = as.character(args[[i]])
arg_vals = arg_vals[2:length(arg_vals)]
arg_vals = paste(arg_vals,collapse=',')
code = paste(arg_name,'=.(',arg_vals,')',sep='')
eval(parse(text=code))
}
}
}
}
I hope this will help you fix the bugs. It is generally unacceptable that a function doesn't allow to be called by another function with variable inputs for its function parameters
The text was updated successfully, but these errors were encountered: