This behavior has to do with the fact that you are subsetting inside a function.
Both new_frame$variable
and subset(new_frame, select = variable)
look for a column in the dataframe withe name variable
.
On the other hand, using new_frame[, variable]
uses the variablename in f(directory, variable, number_seq)
to select the column.