Read this as Active_Inactive equals the result enclosed in the outer () of sending Daily_Activities_dailyActivity_merged from the "left' to ActiveMin while, at the same time, sending rowSums of three columns of something to select the four variables in the select statement either before or after sending it to ActiveMin from the right.
That is trying to go barefoot with shoes on.
Step back and think of the problems in terms of school algebra—f(x) = y, where x is the existing data frame, y is the desired data frame and f is a function (probably composite) to transform x into y.
Start by classifying the variables in the x data frame into three buckets:
Those to appear in y but not needed to create new variables in y
Those needed to create new variables in y
Those unneeded for either
Set aside 1, get rid of 3 and use 2 to get your new variables. Combine 1 and the new variables.