[rkward-devel] correlation plugin [was: another mac issue]
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Dec 22 09:53:18 UTC 2011
Hi,
On Wednesday 21 December 2011, meik michalke wrote:
> that depends -- i was also thinking about adding a second variable slot for
> categorial variables for the poly* correlations, then. they can actually be
> provided as numeric, but especially polyserial() needs the first variable to
> be the "real" numeric one and treats the second as categorial, no matter
> what. right now there's no real control for that, especially not transparent
> check if you provided appropriate data at all. the hack with the
> is.numeric() condition is, well, a little ugly. [but of course polyserial()
> takes ages if it correlates two numerics...]
well, true. But on the other hand, for that reason, polyserial is not really
suitable for creating a classic correlation matrix at all. Perhaps it would
make sense to split up the plugin after all?
If polyserial was moved to a separate plugin, it would indeed make a lot of
sense to ask for ranked and numeric data, separately, thus avoiding the
"is.numeric()" hack(*). For all other coefficients, including polychoric, a
single variable slot should be enough, AFAICS.
> those parts i didn't touch, i think. since there already is a line
> data <- data[complete.cases (data),]
> i'm not sure what you mean, exactly.
Oh, never mind, I had simply overlooked that...
> i actually do that on purpose, and yes, i think it helps readability, or
> more precisely, it prevents at least me to misunderstand anything after
> "if" to be intended as its "else" case, which i must admit happend to me
> in the past. for the same reason i usually write curly brackets even when
> they are not needed.
I must admit, I find empty else clauses a bit unusual. I think I can see your
idea. But since "if" without "else" is quite common both in RKWard and
elsewhere, I'm rather sceptical that it will help to reduce confusion overall.
In the worst case, it might feel deceptively reassuring to others suffering
from the same misunderstanding.
Personally, I often omit the brackets on simple if- and else-statements.
However, when I do (and only then), I write them on a single line, i.e.:
if (cond1) {
if (cond2) foo
} else bar
That said, using curly brackets is never a bad idea, IMO.
Regards
Thomas
(*) In fact, that hack, as well as any other logic based on R data types is
always likely to cause some problems, as I think it is fairly common to store
ranked / ordinal data in a numeric vector. That may make a purist shudder, but
I guess we can expect users with an interest in rank correlations to be aware
of scale type, regardless of the R data types they use.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20111222/0fc8998b/attachment.sig>
More information about the Rkward-devel
mailing list