Keep decimal values in Reduce function

The below code is not showing the value 8.0 to 8.0, its showing values 8.0 to 8.
do we have solution to keep Decimal as it is while applying reduce function.


do you want to calculate or present your results ?
if you want to calculate, then don't concern yourself with 'apparent' precision. just calculate.

Then we you are ready to present, you can use formatting controls to turn your numbers into character strings of desired precision, if your mode of presentation requires that

I think its very useful to remember that calculating and presenting are two different goals, and my advice is not to confuse/blur them.


actually this is just my calculated version, but while knitting it, all the values like 8.0 or 7.0 are showing as 7,8 but rest values like 8.2 or 6.1 are showing as it is.
do we have any solution or this

Your question as it is right now is misleading (I recommend you to change it), the number format is not related to the reduce() function, as Nir said, the graphical representation of your data is not the same as the calculations.

For number formatting with flextable you can use this function

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

Thanks for you suggestions, actually i have created a function, that function is creating a confusion while i am executing line by line , its giving error on one line but while resolving that it again gives error on other line , so that why i have a confusion where the fault is.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.