I would like to change an NA value on the third observation of companyID 1 in column 2 (value) to the character "F". My dataset is huge, so will not be able to say which exact row this observation is on but I will know that it is on the third observation of the company ID for example. I hope this makes sense. Then, I would like fourth observation of companyID 2 in column 2 (value) to be "X". Then, I would like the second observation of companyID 3 in column 2 (value) to be "B", and so on. Each value is different and will lie on a different row of a companyID.
I found the following question which is somewhat similar, but it is unable to give me what I want How to replace certain values in a specific rows and columns with NA in R? .
Here is an example of what I have:
companyID value
1 NA
1 NA
1 NA
1 NA
1 NA
2 NA
2 NA
2 NA
2 NA
2 NA
3 NA
3 NA
3 NA
3 NA
3 NA
And I would like to get the following output:
companyID value
1 NA
1 NA
1 F
1 NA
1 NA
2 NA
2 NA
2 NA
2 X
2 NA
3 NA
3 B
3 NA
3 NA
3 NA
Super appreciative of your help!