[ad_1]
I have a question. Like the title said, now I need to replace some columns with new data from another single excel file. I need to replace them when certain requirements are fulfilled.
For example, I want to replace column R5 to APM (arbitrary column header names, just for example) with new data from another excel file and the following conditions should be met before replacing:
- replace with the same ID, which means I want each person’s ID to be matched when replacing
- do not replace when a column in a row displays “N”. For example, if any cell between R5 to APM in a row has an N, then do not replace it.
Basically, I want to make sure the data is exactly matched.
How can I complete this task in R? Or, how can I achieve it in MS Excel?
Many thanks in advance for your help! I will be very appreciative of each answer.
Below is an example:
enter image description here
Below is the text version of the screenshot:
ID ID
11 2021/4/15 N 9/11/66 56.9 175 cm Standard Test 22 N/A
11 2021/7/29 Y 9/11/66 55.7 186 cm Standard Test 748 N/A 11 2021/7/29 Y TWCOVID 11 1966/11/9 F Caucasian 157 54 NO NO
In the screenshot below, I want to replace new data with ID 11 to the row that indicates Y and to replace the old data with new data beginning from R5 and ending with APM. I can say for sure that the length of each new data is exactly the same as the length of the old data.
[ad_2]