The question hast 2 parts.
Which is the data structure in R that allows to store the paired data:
0:0 0.5:10 1:20(Python dictionary
{[0]:0, [0.5]:10, [1]:20})and how to initiate it with one liner? i.e. to couple
seq(0,1,by=0.5)withseq(0,10,by=5)in this data structureAssume I added
0.25to the list, then I want the weighted average of the neighbor nodes to appear (automatically) in the data set, i.e. the element0.25:5and the paired set would be0:0 0.25:5 0.5:10 1:20If I add the element
0.3, then it must be paired with5+(10-5)*(0.3-0.25)/(0.5-0.25)=6and element0.3:6to be added.
How I can create the class with S4 or Reference Class class model where I could put this functionality?