[RkWard-devel] quantile plug-in
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Sun Feb 19 13:42:42 UTC 2006
> a=c(1,2,3,4,5,6,7,8,9,10)
> quantile(a, probs=seq(0,1,0.1))
> 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
> 1.0 1.9 2.8 3.7 4.6 5.5 6.4 7.3 8.2 9.1 10.0
[...]
> cat ("<TR><TD>dummy</TD><TD>", rk.temp,"</TD></TR>")
> But "0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%" will not be
> shown within the table. What must be done to get it working?
The method Pierre has suggested (using R2HTML / rk.print ()) is the way to go.
Just to solve the mystery of what went wrong, however:
The standard thing R does when you type in a expression (without assigment),
is to call print on it. I.e., writing:
"test"
is equivalent to writing:
print ("test")
and both will result in:
[1] "test"
However, note the subtle difference, when instead, you write:
cat ("test")
which results in:
"test"
instead. The key concept behind this is that cat () just uses the core object
values. print (), on the other hand, may use some additional information on
the objects it operates on, such as their class, or so called attributes.
In this case, the "0% 10%..." is stored in the "names" attribute, and can be
fetched using:
names (rk.temp)
or
attributes (rk.temp)
Two further calls, which help to understand, how R treats some special objects
are (but these don't show anything interesting in this particular case):
class (rk.temp)
unclass (rk.temp)
Well, again, just use the methode Pierre suggested, instead. However, this is
the technical background.
Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20060219/e9958c81/attachment.sig>
More information about the Rkward-devel
mailing list