This question has sort of been asked multiple times, including in this example: Lapply to Add Columns to Each Dataframe in a List.
However, I simply want to add an argument within a function that creates a new column, and that column has a value based on input.
dfs<-lapply(clients_names, function(x){
df<-read.csv(...),
##this is when I want to add a column to the df loaded,
##a column of clients with names their names)
return(df)
})
I tried using df$clients<- x
in place of ##
but that did not work.
UPDATE:
client_names<-c("Bob", "Sam", "Chris")