Identify the original variable used to calculate the dummies I have a data frame where many quantitative variables have been recoded as dummy variables.
Here is a reproductible example using R:
age <- round(runif(100, 15, 40), 0)

as.dummy <- function(variable, min, max){
  sapply(variable, function(x) 
    if((!is.null(min) && x> min | is.null(min)) & ((!is.null(max) && x <= max) | is.null(max) ) )
      1
    else
      0
  )
}

age2 <- as.dummy(age, NULL, 20)
age3 <- as.dummy(age, 20, 25)
age4 <- as.dummy(age, 25, 30)
age5 <- as.dummy(age, 30, NULL)
tab <- data.frame(age, age2, age3, age4, age5)

Is there a way to detect that age2...5 are constructed from the variable age? 
I would like to be able to detect those dummy variables and remove them of the data frame. 
Here I give the example of variables coded 0/1 but it can be also coded as "yes/no", or anything else.
 A: This answer suggests there is value in a graphical exploration of relationships among the variables and illustrates one useful way.  It then provides a simple solution that rapidly and automatically identifies all possible variables that might be represented by a given categorical variable.

You can explore graphically by drawing a scatterplot matrix of the age categories and all numerical variables in the data frame.  If there are many variables, summarize each by age and check that they fall into non-overlapping intervals.
Here are some sample data for illustration.  The grouping variable is V1, but let's pretend we don't know that.
#
# Create data for testing.
#
n.obs <- 100
n.vars <- 4
X <- as.data.frame(matrix(round(runif(n.obs*n.vars, 15, 40), 0), n.obs))
#
# Create the dummary variable.
#
cutpoints <- c(-Inf, 20, 25, 30, Inf)
Age <- data.frame(group=cut(X$V1, cutpoints))

This scatterplot matrix makes it obvious that variable V1 corresponds to the age groups in group, because it is the only variable that is clearly partitioned by a scatterplot in the group row or column:
colors <- rainbow(length(cutpoints), alpha=0.6)
names(colors) <- unique(Age$group)
pairs(cbind(X, Age), pch=21, bg=colors[Age$group])


I recommend using this approach in any event because if no variables are found to match the age variable (as shown below), with this plot you may quickly identify any variables that almost match it.  This can be useful for forensic activities such as identifying inconsistencies in a data table.
An R implementation of a summary by age uses tapply to break data into groups by age and by to compute their ranges.  If these are non-overlapping (as ordered by by), you have a candidate for a correspondence with age.
#
# Identify all columns of X that might match Age.
# The result is a logical vector indicating which fields of X match.
#
candidates <- sapply(names(X), function(f) {
  groups <- tapply(X[[f]], Age)
  boundaries <- unlist(by(X[f], groups, range))
  identical(order(boundaries), 1:length(boundaries))
})

message(paste0("Possible variables are (", paste(names(X)[candidates],
                collapse=","), ")."))

The output is

Possible variables are (V1).

Although this example used data in the form usually stored in a database--namely, as a categorical variable--it will work without change when Age is a data frame in the format given in the question: unique rows of Age are used for grouping.
A: If you can perfectly reconstruct the dummies from a candidate predictor, then the dummies and the predictor carry the same information. If the dummies encode intervals of the predictor (the most common way of discretizing continuous predictors, which is a bad idea, as discussed often here on CV, but that's not the focus), then you should be able to model the dummies perfectly with a multinomial logistic regression on the predictor:
library(nnet)
# encode the dummies into a single factor variable:
tab$age.level <- as.factor(apply(tab[,-1],1,function(xx)min(which(xx==1))))
model <- multinom(age.level~age,tab)
predict(model)
table(predict(model),tab$age.level)

     1  2  3  4
  1 12  0  0  0
  2  0 22  0  0
  3  0  0 25  0
  4  0  0  0 41

We get a perfect confusion matrix. This would be convincing enough for me.
A: To detect that age2...5 are constructed from the same variable, you can check if the sum of those dummy variables equals 1 :
all(age2+age3+age4+age5==1)

But I don't know if there is a way to check if they come specifically from the variable age, it could be any other variable in the dataframe.
