[R] Best way to store negative indexes

StephaneDemurget demurget at aleks.com
Wed Jul 28 02:42:30 CEST 2004


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 :)

ATM, I use as.character (i-j) to index my data, but I lose all the 
processing power of R there after.

Sorry If it's written somewhere, but I read a lot of docs about it, 
searched through the ML archives and didn't manage to find an answer.

Please also answer me back at my email address as I am not subscribed to 
the list.

Best regards,

--Stephane




More information about the R-help mailing list