[R] Best way to store negative indexes

Adaikalavan Ramasamy ramasamy at cancer.org.uk
Wed Jul 28 02:47:13 CEST 2004


Do you mean something like 
  abs( my_vector[i] - my_vector[j] )

See if reading help("subset") helps.


On Wed, 2004-07-28 at 01:42, StephaneDemurget wrote:
> 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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
>




More information about the R-help mailing list