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

2013-04-14 Thread arun
e - From: "Sparks, John James" To: r-help@r-project.org Cc: Sent: Sunday, April 14, 2013 1:19 PM Subject: [R] Create New Column Inside Data Frame for Many Data Frames Dear R Helpers, I have a large number of data frames and I need to create a new column inside each data frame.  Be

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

2013-04-14 Thread Jeff Newmiller
I suggest you read the section on indexing in the Introduction to R document that comes with R. In particular, look at the [[i]] notation. This comes in handy in a couple of ways. First, you shouldn't be working with "many" data frames at once that are stored as separately-named objects. If you

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

2013-04-14 Thread Rui Barradas
Hello, I'm not completely sure I've understood. Your variable 'letters' iholds the names of the data.frames? If so it's better if you put yoyr data.frames in a list and then use that list. Something like lst <- list(A, B) for (i in seq_along(lst)){ lst[[i]][["Rate"]] <- ROC(lst[[i]]

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

2013-04-14 Thread Sparks, John James
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 dynamically. Below is a simple example of what I need to do.