[rkward-devel] New plugin and functions
I. Soumpasis
nono.231 at gmail.com
Sat Apr 28 06:23:43 UTC 2007
2007/4/26, Thomas Friedrichsmeier <thomas.friedrichsmeier at ruhr-uni-bochum.de
>:
>
> Another option would be to do something like the following (untested):
> <?
> // in calculate
> $yvars = "substitute (" . str_replace ("\n", "), substitute (",
> trim
> (getRK_val ("y"))) . ")";
> ?>
>
> yvars <- list (<? echo ($yvars); ?>)
> res_tables <- list ()
> res_names <- c ()
> res_chisq <- list ()
> for (i in 1:length (yvars)) {
> yvar <- eval (yvars[[i]], envir=globalenv ())
> res_names[i] <- rk.get.short.name (yvars[[i]], is.substitute=TRUE)
>
> res_tables[i] <- table (x, yvar)
> res_chisq[i] <- chisq.test (x, yvar)
> }
> names (res_tables) <- res_names
>
> <?
> // in printout
> for (i in 1:length (res_tables)) {
> # do the printing, and the barplots
> }
> ?>
>
> The main benefit is that we have information on the names of the variables
> available. On the other hand, this can probably be achieved nicely with
> cbindlist as well (dimnames(y)[[2]]), I don't have the patience right now
> to
> think this through.
>
> Another concept however, is that it logically separates calculating the
> results from printing them, which is a good idea, either way (but can also
> be
> achieved with cbindlist). Also, saving the results to the workspace would
> become real easy, now, as there is already one variable holding all the
> results.
If I get it right in this way we will print a bunch of tables, then a bunch
of chisquares and then a bunch of barplots. Do we want this, or do we want
as I have it for every crosstabulation to print the table, chisq and
barplot? I would like to have a final decision on this before I go to any
changes.
> I have two problems:
> > 1. I get this error.
> >
> > Error in table(x, y[, i]) : subscript out of bounds
> >
> > However the results are right. The hours are long right now and I can
> not
> > think the reason.
>
> length(y) returns the number of rows in the matrix, not the number of
> columns.
> In your approach, you'd need dim(a)[2].
Thanks, I thought I was creating a data.frame.
> 2.There are some more warnings printed.
> >
> > Warning messages:
> > 1: Chi-squared approximation may be incorrect in: chisq.test(xy)
> [...]
>
> > Should and how can we supress them?
>
> Well, they do have a reason, so we should not suppress them. To make them
> go
> away, you could use the simulate.p.value option of chisq.test (should be
> optional).
>
> I added an option for simulating of p.value.
Regards,
Ilias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20070428/c766aaa8/attachment.html>
More information about the Rkward-devel
mailing list