So I am working with a CSV file in RStudio. I am trying to find out in which row does the sum of the numbers in a specific column add up to cumulative number 0.8 (80%) (or a close value).
This is what the column looks like when I extract it
[1] 0.165705620 0.087013121 0.066435240 0.058204088 0.046089979 0.044273757 0.038910088 0.038449322 0.027019652 0.026174169
[11] 0.021463624 0.021065487 0.016690451 0.014252419 0.010874963 0.009340568 0.009192944 0.007493033 0.007475139 0.007403564
[21] 0.007340935 0.006933851 0.006446245 0.006423877 0.006312041 0.006294147 0.006231519 0.006074948 0.005641023 0.005596289
[31] 0.005046054 0.004992373 0.004285567 0.004088735 0.004079788 0.004075315 0.003838222 0.003762173 0.003574288 0.003493766
[41] 0.003457979 0.003431138 0.003422191 0.003220886 0.003149310 0.003131417 0.003059841 0.002970372 0.002943532 0.002934585
[51] 0.002916691 0.002863009 0.002809328 0.002733279 0.002424611 0.002415664 0.002402244 0.002361983 0.002187518 0.002174098
[61] 0.002169624 0.002102523 0.002093576 0.002008580 0.001977266 0.001968319 0.001865430 0.001802801 0.001767014 0.001695438
[71] 0.001690965 0.001588076 0.001588076 0.001538868 0.001529921 0.001516500 0.001449399 0.001418084 0.001382297 0.001324142
[81] 0.001292828 0.001270460 0.001261514 0.001163098 0.001131783 0.001095996 0.001073629 0.001060208 0.001042314 0.001024421
[91] 0.001006527 0.000979686 0.000979686 0.000975213 0.000966266 0.000926005 0.000908111 0.000908111 0.000881270 0.000876797
[101] 0.000854429 0.000845482 0.000832062 0.000787328 0.000787328 0.000782854 0.000769434 0.000733646 0.000724699 0.000697859
[111] 0.000693385 0.000693385 0.000671018 0.000671018 0.000657597 0.000644177 0.000639704 0.000621810 0.000612863 0.000581549
[121] 0.000572602 0.000572602 0.000572602 0.000550235 0.000536814 0.000536814 0.000532341 0.000523394 0.000514447 0.000509974
[131] 0.000505500 0.000505500 0.000501027 0.000496553 0.000492080 0.000469712 0.000469712 0.000465239 0.000451819 0.000442872
[141] 0.000438398 0.000429451 0.000429451 0.000424978 0.000416031 0.000416031 0.000411558 0.000407084 0.000407084 0.000389190
[151] 0.000389190 0.000384717 0.000380243 0.000380243 0.000375770 0.000366823 0.000348929 0.000339982 0.000339982 0.000339982
[161] 0.000335509 0.000335509 0.000331035 0.000317615 0.000317615 0.000313142 0.000313142 0.000304195 0.000299721 0.000299721
[171] 0.000295248 0.000286301 0.000281827 0.000281827 0.000277354 0.000272881 0.000272881 0.000268407 0.000263934 0.000259460
[181] 0.000259460 0.000259460 0.000254987 0.000250513 0.000237093 0.000232620 0.000228146 0.000228146 0.000228146 0.000223673
[191] 0.000223673 0.000223673 0.000210252 0.000205779 0.000201305 0.000201305 0.000201305 0.000201305 0.000196832 0.000196832
[201] 0.000196832 0.000192358 0.000187885 0.000187885 0.000183412 0.000183412 0.000178938 0.000174465 0.000174465 0.000169991
[211] 0.000169991 0.000169991 0.000169991 0.000165518 0.000165518 0.000161044 0.000161044 0.000156571 0.000156571 0.000156571
[221] 0.000152097 0.000152097 0.000152097 0.000152097 0.000152097 0.000152097 0.000152097 0.000147624 0.000147624 0.000147624
[231] 0.000143150 0.000138677 0.000138677 0.000138677 0.000138677 0.000134204 0.000129730 0.000120783 0.000120783 0.000116310
[241] 0.000116310 0.000116310 0.000116310 0.000111836 0.000111836 0.000111836 0.000111836 0.000107363 0.000107363 0.000107363
[251] 0.000107363 0.000102889 0.000102889 0.000102889 0.000098400 0.000098400 0.000093900 0.000093900 0.000093900 0.000093900
[261] 0.000093900 0.000093900 0.000089500 0.000089500 0.000089500 0.000089500 0.000089500 0.000089500 0.000085000 0.000085000
[271] 0.000085000 0.000080500 0.000080500 0.000080500 0.000076000 0.000076000 0.000076000 0.000071600 0.000071600 0.000071600
[281] 0.000071600 0.000067100 0.000067100 0.000067100 0.000067100 0.000067100 0.000067100 0.000062600 0.000062600 0.000062600
[291] 0.000062600 0.000058200 0.000058200 0.000058200 0.000058200 0.000058200 0.000058200 0.000058200 0.000058200 0.000053700
[301] 0.000053700 0.000053700 0.000053700 0.000053700 0.000053700 0.000053700 0.000053700 0.000049200 0.000049200 0.000049200
[311] 0.000049200 0.000049200 0.000049200 0.000049200 0.000049200 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700
[321] 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700 0.000044700
[331] 0.000044700 0.000040300 0.000040300 0.000040300 0.000040300 0.000040300 0.000040300 0.000040300 0.000040300 0.000040300
[341] 0.000040300 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800
[351] 0.000035800 0.000035800 0.000035800 0.000035800 0.000035800 0.000031300 0.000031300 0.000031300 0.000031300 0.000031300
[361] 0.000031300 0.000031300 0.000031300 0.000031300 0.000031300 0.000031300 0.000026800 0.000026800 0.000026800 0.000026800
[371] 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800 0.000026800
[381] 0.000026800 0.000026800 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400
[391] 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400 0.000022400
[401] 0.000022400 0.000022400 0.000022400 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900
[411] 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900
[421] 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900 0.000017900
[431] 0.000017900 0.000017900 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400
[441] 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400
[451] 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400
[461] 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000013400 0.000008950 0.000008950 0.000008950 0.000008950
[471] 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950
[481] 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950
[491] 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950
[501] 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950
[511] 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950 0.000008950
[521] 0.000008950 0.000008950 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[531] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[541] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[551] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[561] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[571] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[581] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[591] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[601] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[611] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[621] 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470 0.000004470
[631] 0.000004470
I tried using the sum function but couldn't figure out a way to sum a specific amount of rows so the function ends up summing the entire row.
library(ggplot2)
#Step 1
SumWeldInfo <- read.csv(file="C:\\Users\\ahmed\\Documents\\Assignment 4\\sum_weld_info.csv", header=TRUE, sep=",")
sum(SumWeldInfo$work.proportion)
I have also tried messing around with ggplots to see if there's a way to graph it out and figure out the number but no luck graphing the cumalative percentage. I could only graph the individual percentages.
So basically I need a function that lets me sum up a specific amount of rows in this column within a csv file OR a function that lets the sum of a specific amount of rows equal to 0.8 and outputs how many rows it took to reach that number