0
# Dataset name : df 
    Int.Index  Int.Line Name  Index  Index.Line  Amount
    340         1       John  440      1          700
    ""          2       John  440      2          100
    ""          3       John  400      3           50
    450         1       May   500      1         2401
    5694        1       Paul  6023     1         1312
    ""          2       Paul  6023     2         7244

Desired Output

# Desired ouput 
    Int.Index  Int.Line Name  Index  Index.Line  Amount
    340         1       John  440      1          700
    340         2       John  440      2          100
    340         3       John  400      3           50
    450         1       May   500      1         2401
    5694        1       Paul  6023     1         1312
    5694        2       Paul  6023     2         7244

I am a beginner know what group_by function doing but cannot achieve the copy value part of it .

  • Can you edit your question so it's easy for us to cut and paste and get your df into our R sessions to work on this? Thanks. – mysteRious Mar 16 '18 at 04:55
  • Replace [Blank Cells to “NA”](https://stackoverflow.com/questions/24172111/change-the-blank-cells-to-na) and then [use na.locf to replace with latest non-NA value](https://stackoverflow.com/questions/14655286/replace-missing-value-with-previous-value). – Ronak Shah Mar 16 '18 at 04:58
  • df <- read.table( header = T, text = 'Int.Index Int.Line Name Index Index.Line Amount 340 1 John 440 1 700 "" 2 John 440 2 100 "" 3 John 400 3 50 450 1 May 500 1 2401 5694 1 Paul 6023 1 1312 "" 2 Paul 6023 2 7244 ') Thankyou mysteRious , here is the data with script – GeanLoeson Mar 16 '18 at 15:00

0 Answers0