1 Prepare the data

1.1 Import files

To execute the following code, we need to load three extra packages.


We first import a list of all german text files to have a list of all the files in the folder. This list is the object de_filelist that we created.

de_filelist <- list.files(path = ".",
                         pattern ="DE.*\\.txt")
## [1] 221

Then, we apply the function that imports the actual data sets to the entire list of German text files. This corresponds to the object de_files that we created, which is a list of all 233 data frames for German.

de_files <- lapply(de_filelist, function(x) {
  read.delim(x, header = FALSE, sep = "\t", blank.lines.skip = FALSE)

## [1] 221

In order to access an element from a list, we use square brackets like in the following command, which outputs the German text of our list of German texts.