The short and sweet code here is really powerful—and gives us a lot of analysis in a few commands.
In Step 1, initially, we load the libraries we require.
In Step 2, after loading the necessary libraries, we make a character vector, treefiles, which holds paths to the 20 trees we wish to use. The list.files() function that we use takes a filesystem path as its argument and returns the names of files it finds in that path. As treefiles is a vector, we can use it as the first argument to lapply().
In case you're not familiar with it, lapply() is an iterator function that returns an R list (hence, lapply()). Simply put, lapply() runs the function named in the second argument over the list of things in the first. The current ...