simonhmartin / twisst

Topology weighting by iterative sampling of sub-trees
GNU General Public License v3.0
72 stars 19 forks source link

take min/max values instead of first/last of seq function #27

Closed giyany closed 6 days ago

giyany commented 2 years ago

Fixes https://github.com/simonhmartin/twisst/issues/12

when assigning l$pos[[i]] inside smooth.twisst, seq function seemed to pick the chronological first and last values in pos. However, some users may produce window_data_files with columns that are not sorted (mine was sorted 'naively' on command line, hence lexicographic sorting), and the error was caused by seq recieving values in which from < to.

Using instead the min/max values in the column can fix this, data not being sorted causes further issues, for example with plot.twisst, so a more holistic solution may be better.

Cheers, thank you for this tool!

simonhmartin commented 2 years ago

Thanks for the suggestion. I would prefer for users to use the existing solution, using option reorder_by_start=TRUE in the import.twisst function, because having the files out of order could break other functions and it would be less efficient to create bespoke solutions in each case.