In R, I have a dataframe df1 that looks like
| variable | location |
|---|---|
| a | T1 |
| b | T2 |
| c | T1 |
location corresponds to the name of another dataframe. I am trying to create a function to update the contents of this dataframe (in this case either T1 or T2).
My approach so far is as follows t <- df1$location[df1$variable == "a"] this sets t = "T1" now I would like to create a function doesSomething <- function(df) and pass the value stored in t as an argument to the function. Ideally calling doesSomething(t) would allow me modify the dataframe T1 within the function.