Could not find function "train"

As a note, it is extremely hard to help debug code and/or error messages when screenshots are posted. Posting screenshots, instead of actual code/error messages, is likely to decrease your chances of getting the help you are looking for in general. Instead of posting a screenshot, please copy and paste the code and error message and format the pasted code/error messages as shown below.

Put code that is inline (such as a function name, like mutate or filter ) inside of backticks ( mutate ) and chunks of code (including error messages and code copied from the console) can be put between sets of three backticks:

example <- foo %>%
  filter(a == 1)

This process can be done automatically by highlighting your code, either inline or in a chunk, and clicking the </> button on the toolbar of the reply window!

This will help keep our community tidy and help you get the help you are looking for!

For more information, please take a look at the community's FAQ on formating code

Furthermore, your errors seem to relate to your data, which we do not have.
but following the reprex guide you could provide an example of a part.
If you have used read.table to put your data into projet
you can share with us via


and create your example around that.

See the reprex guide for the full version of this sort of forum advice.