title: How to append the same column to several data frames with a loop
body: <p>i really hope someone can help me on this.
  I have 40 excel files with data. Each of these files contain several data columns, and i have to take only 2 of them.
  While "reading" these files to bring them in R as data frames, i have to name them as "client" and a number (e.g. client1, client2, etc.) and possibly to add in each of them a column with values taken from a list i already have in R, called p, that should be named as Pasqua in the data frames.
  I wrote this code</p>
  
  <pre><code>for (e in seq(1:40)){
      assign(paste0("client",e),read_excel(paste("C:/Users/Windows 10/Desktop/DS/",e,".xlsx",sep=""),
  col_types = c("skip", "numeric", "skip", "numeric", "skip", "skip", "skip","skip", "skip")))}
  </code></pre>
  
  <p>This works, and i then have 40 data frames as wished. </p>
  
  <p>But if i try to insert in the loop the code to append the column i face several errors:
  i tried in this way</p>
  
  <pre><code>paste0("client",e,"[,Pasqua]")&lt;-p
  </code></pre>
  
  <p>I have error <code>target of assignment expands to non-language object</code>  since it seems R is not capable to handle assignments, with name of variables "built" in this way</p>
  
  <p>then also in this way</p>
  
  <pre><code>df[,"Pasqua"]&lt;-p
  </code></pre>
  
  <p>i have this error <code>object of type 'closure' is not subsettable</code>  </p>
  
  <p>Searching here on other users' posts i understand that a way can be using lapply() but i haven't found a way to use it properly.
  Can someone explain me how to handle this?
  Thank you in advance</p>