How do I create a dataset using computed values?
up vote
0
down vote
favorite
Please see here the input and desired output tables. I have a dataset (df_report) that looks like this: city <- c("New York","Mexico City","Cape Town") A <- c(3,4,1) B <- c(5,1,3) C <- c(0,3,2) category <- c("Complete","Incomplete","Complete") df_report <- data.frame(city, category, A, B, C) Then the logic/ formula for the variables: RB_1 <- df_report["Complete","A"] + df_report["Complete","B"] RB_2 <- sum(df_report["Incomplete",]) - df_report["Incomplete","C"] RB_3 <- sum(df_report["Complete",]) RB_4 <- RB_1 + RB_2 How do I make a separate dataset with the following? Row header: Variable; Column: City
...