0

Sample Dataframe

df <- structure(list(numbers = c(0, 32, 3, 19, 1, 2, 10, 14, 12, 7, 
                           713, 688, 1577, 692, 1223, 671, 712, 739, 1411, 1389, 1796, 2378, 
                           2382, 806, 608, 1194, 638, 593, 2512, 986, 538, 723, 1557, 916, 
                           1178, 1272, 537, 471, 1158, 1527, 633, 764, 714, 1000, 900, 824, 
                           918, 1015, 491, 1140, 778, 951, 836, 985, 1357, 780, 579, 574, 
                           1075, 1086, 458, 815, 830, 975, 803, 949, 769, 910, 906, 1166, 
                           429, 623, 690, 920, 1108, 2270, 2272, 622, 1374, 1395, 1748, 
                           590, 777, 889, 1222222, 737, 2.3, 856, 1089, 2.4, 799, 962, 469, 
                           1162, 1763, 1813, 876, 1478, 729, 1112, 819, 817, 1228, 1155, 
                           1595, 1990, 1998, 1023, 1025, 1157, 768, 693, 610, 928, 1777, 
                           2506, 636, 983, 1634, 1638, 937, 635, 1119, 1036, 1466, 972, 
                           899, 1039, 1044, 875, 1355, 562, 1047, 551, 1058, 1164, 1795, 
                           1284, 1280, 2796, 1929, 1376, 1924, 2413, 1005, 662, 1181, 620, 
                           1550, 512, 531, 2988, 720, 625, 629, 1231, 892, 775, 1137, 1084, 
                           667, 818, 516, 1353, 1431, 1154, 687, 869, 868, 1203, 1204, 1589, 
                           933, 1400, 845, 1007, 697, 1350, 695, 1352)), .Names = "numbers", row.names = c(NA, 
                                                                                                           -180L), class = "data.frame")

why is sum(df$number, na.rm=TRUE) returning 1403761. Yet the actual value is 1403760.7 Remember that the column contains decimal values

Karthik S
  • 11,348
  • 2
  • 11
  • 25

1 Answers1

1

enter image description here

Taking a subset there are only so many digits displayed by default. You can up this with

options(digits=8) for example to see more digits