[R] Create New Column Inside Data Frame for Many Data Frames

Sparks, John James jspark4 at uic.edu
Sun Apr 14 19:19:46 CEST 2013

Dear R Helpers,

I have a large number of data frames and I need to create a new column
inside each data frame.  Because there is a large number, I need to "loop"
through this, but I don't know the syntax of assigning a new column name

Below is a simple example of what I need to do.  Assume that I have to do
this for all 26 letters and you should see the form of the problem.

Any help would be much appreciated.  If more information is needed, please
let me know.

Many thanks.
--John Sparks

A <- data.frame(population=c(100, 300, 5000, 2000, 900, 2500))

B <- data.frame(population=c(200, 300, 4000, 3000, 2000, 500))


#for (i in letters){

More information about the R-help mailing list