Predict future attrition with survival analysis

Hi, I was wondering if, like with machine learning algos - regression, decision trees etc-, one can use survival analysis to predict outcomes for new data not included in the model development process (ie Train and Test approach). If so, how can I use the predict() function in R to do so?

Thank you

Build a model, say you have given model_glm for a logistic regression model.

then

pred = predict(object = model_glm, newdata = testdata)

this will give the prediction of test data in pred variable

thanks for your answer, but i was asking more about survival analysis prediction.