You can do this in each row at once, but you are using paired columns between two data.frames. Since you have a specific paste task that needs to be done each time, define a function:
pfun <- function(x, y) paste(x - y, x + y, sep = "-")
and then create a new data.frame using the function:
datNew <- data.frame(a = pfun(datMean$a, datSE$a), b = pfun(datMean$b, datSE$b), d = pfun(datMean$d, datSE$d))
There would be ways to use this, but perhaps it will help you better understand. You can pass integer columns to insert, but not integer data.frames.
Use a loop to match all columns in the result without specifying them separately.
First, create a list to store all the columns, we will convert it to data.frame with the names of the right columns.
datNew <- vector("list", ncol(datMean))
Naming really assumes that the column number, names and order are an exact match between two input data frames.
names(datNew) <- names(datMean) for (i in 1:ncol(datMean)) { datNew[[i]] <- pfun(datMean[[i]], datSE[[i]]) }
Convert to data.frame:
datNew <- as.data.frame(datNew)