Skip to content
Prev 377450 / 398502 Next

help with grouping data and calculating the means

On Thu, Nov 15, 2018 at 10:40 AM Boris Steipe <boris.steipe at utoronto.ca> wrote:
No.
[1] 0.12 0.13

As I understand it, the OP said he wanted the last decimal to be ignored.

The OP also did not specify what he wanted to calculate means of. I
assume TK-QUADRANT. It is also not clear whether the calculations are
to be done separately by latitude and longitude, or both together.
I'll assume separately. In which case, the calculation of TK-QUADRANT
means by e.g. grouped according to 4 decimal digit values of latitude
could be done using(using the provided example data):
(Note: ignore all that follows if my interpretation is incorrect)
549249  549749  550249  550749
10158.5 10156.5  9163.5  9161.5

## Note that this assumes positive values of latitude, because:
[1] -2  1

This could be easily modifed if both positive and negative values were
used: e.g.
[1] -1  1

Confession: I suspect that this exponentiate and floor() procedure
might fail with lots of decimal places due to the usual issues of
binary representations of decimals. But maybe it fails even here. If
so, I would appreciate someone pointing this out and, if possible,
providing a better strategy.

Cheers,
Bert