On 2011-07-29 20:28, Wells Oliver wrote:
Hey folks - trying to iterate through the quantile object and use the
keys as numeric values, so like:
for a, b in percentiles.iteritems():
print a, b
The key, a, is a string, '5%', etc, but I'd like to use the numeric
representation (.5). Is there a way of cleanly doing that w/o
manipulating the key as a string?
Strictly speaking, 'a' is not a key, but just a label along each element
'b' in the vector 'percentiles' (R does not enforce names to be unique).
Also, in R labels are strings:
# R code
> x = c(1,2,3)
> names(x) <- x
> x
1 2 3
1 2 3
> names(x)
[1] "1" "2" "3"
> names(x) <- c(1,2,1)
> names(x)
[1] "1" "2" "1"
Beside that a call to R's quantile() is like:
quantile(x, p, type = type)
and 'p' contains the numeric values in the column names; you can iterate
through the values of 'p'.
Hoping this helps,
L.
PS: The numeric representation for 5% is more '0.05' than '.5', I think.
Thanks.
--
Wells Oliver
wellsoli...@gmail.com <mailto:wellsoli...@gmail.com>
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list