Change as.factor to ratify