As an update. The issue that seems to be throwing the error is the call to a
function "percent_in_category" that has single quoted expressions in the
ListExpr:
Browse[1]> ListExpr
expression(quote(as.list(c(median_na(SGP), median_na(SGP_TARGET),
percent_in_category(CATCH_UP_KEEP_UP_STATUS, list(c('Catch Up: Yes', 'Keep Up:
Yes')), list(c('Catch Up: Yes', 'Catch Up: No', 'Keep Up: Yes', 'Keep Up:
No'))), num_non_missing(SGP), percent_in_category(ACHIEVEMENT_LEVEL,
list(c('Proficient', 'Advanced')), list(c('Unsatisfactory', 'Partially
Proficient', 'Proficient', 'Advanced'))), num_non_missing(ACHIEVEMENT_LEVEL),
percent_in_category(ACHIEVEMENT_LEVEL_PRIOR, list(c('Proficient', 'Advanced')),
list(c('Unsatisfactory', 'Partially Proficient', 'Proficient', 'Advanced'))),
num_non_missing(ACHIEVEMENT_LEVEL_PRIOR)))))
When I isolate in my testing, it gives the same error:
Error during wrapup: invalid 'type' (character) of argument
Anybody know of a workaround for this or a simplification of the approach I'm
taking.
thanks,
Damian
Damian Betebenner
Center for Assessment
PO Box 351
Dover, NH 03821-0351
Phone (office): (603) 516-7900
Phone (cell): (857) 234-2474
Fax: (603) 516-7910
[email protected]<mailto:[email protected]>
www.nciea.org<http://www.nciea.org/>
From: Damian Betebenner
Sent: Saturday, August 13, 2011 9:05 PM
To: '[email protected]'
Subject: eval(eval issue
All,
A line of code that used to work version 1.6.2 is now throwing an error so I
thought I'd see if anyone knows exactly what is going on. The error that I now
get is:
Error during wrapup: invalid 'type' (character) of argument
The call that is generating the error is:
tmp <- tmp.dt[, eval(eval(ListExpr)), by=eval(eval(ByExpr))]
It is essentially a
x[,j=ListExpr,by=ByExpr] call but the j is a long of custom functions and the
ByExpr is a list of variables in x that changes via a loop.
Currently (what is broken), the ListExpr and ByExpr are created using the
following:
ListExpr <- parse(text=paste("quote(as.list(c(",
paste(unlist(tmp.sgp.summaries), collapse=", "),")))",sep=""))
ByExpr <- parse(text=paste("quote(list(", paste(sgp.groups.to.summarize,
collapse=", "), "))", sep=""))
For example, ListExpr is:
Browse[1]> ListExpr
expression(quote(as.list(c(median_na(SGP), median_na(SGP_TARGET),
percent_in_category(CATCH_UP_KEEP_UP_STATUS, list(c('Catch Up: Yes', 'Keep Up:
Yes')), list(c('Catch Up: Yes', 'Catch Up: No', 'Keep Up: Yes', 'Keep Up:
No'))), num_non_missing(SGP), percent_in_category(ACHIEVEMENT_LEVEL,
list(c('Proficient', 'Advanced')), list(c('Unsatisfactory', 'Partially
Proficient', 'Proficient', 'Advanced'))), num_non_missing(ACHIEVEMENT_LEVEL),
percent_in_category(ACHIEVEMENT_LEVEL_PRIOR, list(c('Proficient', 'Advanced')),
list(c('Unsatisfactory', 'Partially Proficient', 'Proficient', 'Advanced'))),
num_non_missing(ACHIEVEMENT_LEVEL_PRIOR)))))
And ByExpr is:
Browse[1]> ByExpr
expression(quote(list(STATE, CONTENT_AREA, YEAR, GRADE,
STATE_ENROLLMENT_STATUS, CATCH_UP_KEEP_UP_STATUS_INITIAL)))
I'm sure this can be simplified.
Any help greatly appreciated,
Damian
Damian Betebenner
Center for Assessment
PO Box 351
Dover, NH 03821-0351
Phone (office): (603) 516-7900
Phone (cell): (857) 234-2474
Fax: (603) 516-7910
[email protected]<mailto:[email protected]>
www.nciea.org<http://www.nciea.org/>
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help