I have a Raw 'data.frame A' containing results from a set of measurements taken in a time course experiment. There are Control and Test Treatment variables, two Animals per Treatment, three measurements per Animal, and Day 1, 2, and 3 as Time points.
I have written code to generate a separate 'data.frame B' that converts a number of outliers into NA's. These NA's are associated with specific combinations of Treatment-Animal-Measure column values. My goal is to use a list of such combined values from 'data.frame B' to search for matched cases in 'data.frame A' and replace the number in the value column with NA, across all Timepoints in the data set.
I have looked into indexing, lapply(), and for loops to tackle this problem, but am getting stuck pretty early in each case. Here is an image of the desired 'data.frame C' showing the replacements I am after:
Any guidance on best course of action, or a solution, would be much appreciated!
replace. To get the condition in your third image you could do something likedf$Value = replace(df$Value, df$Measure == 'B2', NA_real)- svenhalvorson&and|between columns of data.frame A and then use these to index the replacements in data frame B. - svenhalvorson