Logistic Regression for Prediction Suppose we have a data set with a binary outcome variable $y$. The predictor variables are $x,w$ and $z$. This is the training data set. We obtain a logistic regression model from this training data set. Now suppose we have a test data set and want to predict $y$. In R, we use the  predict  function to do this. But we end up with predicted probabilities instead of $1$ or $0$. How would we convert the probabilities to either a $1$ or $0$?
 A: If you want to convert to 0/1 (or other pairs) based on a cutoff, then you can just use the ifelse function:
ifelse( preditedProb > cutoff, 1, 0 )

But of course this throws away a bunch of information.  
A: predict() returns P(Class|features), this is the inference step that R handles for you. Next comes the decision step, where you make optimal decisions given these conditional class probabilities. 
Imposing a cut-off value (e.g. in the most naive case: 0.5) is an option, where you do:
threshold = 0.5
if P(C1|features) > threshold:
   class= C1
else:
   class= C2

Note that for cases where class probabilities are close to each other, you may choose to reject to make a classification, such as:
reject_threshold = 0.6
if max(P(C1|features),P(C2|features) ) < reject_threshold:
    print: "We are unsure and opt not to classify"
else:
    class = max(P(C1|features),P(C2|features) )

Overall, based on the thresholds you use, your confusion matrix is going to vary. You need to make use of cost/utility functions (which may e.g. more heavily penalise False Positives compared to False Negatives), take into account class priors, and any other application-specific idiosyncracies.
Summary: Converting the probabilities to either 1 or 0 is your decision step and hence application specific.   
