StephaneDemurget <[EMAIL PROTECTED]> writes:
> Hi,
>
> I'm trying to figure out how to properly construct a graph of
> frequencies of a difference between 2 values, that is | i | - | j |.
> I'd like to know the best way to store the actual data because of
> course doing my_vector[i -j] will not work because the index could be
> negative.
>
> I know there's no hash table so what's the best solution,
> simplicity-wise ? Use a list of pair of values {index, i - j} ? Or can
> I somehow use negative index, perhaps using 0array ? Any help would be
> appreciated :)
(i and j are integer vectors, right?)
How about this:
f <- i - j
f <- factor(f,levels=min(f):max(f))
table(f)
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html