train, trainControl function not working.

Don't forget to mark the solution, it helps others find solutions to similar problems.