Write a function readfiles()
for external files such as plantgrowth_1.txt
, plantgrowth_2.txt
and plantgrowth_3.txt
. It takes two arguments:
files
which is a vector with file nameslabels
which can be an optional vector with labels for the research centersThis function should read in all the files mentioned in the first argument files
, combine them into a single data frame which also contains a new column origin
. The values in origin
should depend on what was specified for the argument labels
: if some values were specified, then origin
should use these as labels for the research centers; if left unspecified, then origin
should contain the file names as specified in the argument files
. Be sure to include the necessary checks and messages for the user.
There is no need to read in any data files since Dodona will already use plantgrowth_1.txt
, plantgrowth_2.txt
and plantgrowth_3.txt
.