Dear Mark,
Try this:

lapply(yourlistofdataframes, function(d){
                   k <- ncol(d)
                   d$product <- d[,k-1] * d[,k]
                   d
                    }
           )

HTH,

Jorge


On Thu, Jul 23, 2009 at 2:05 PM, Mark Na <mtb...@gmail.com> wrote:

> Hi R-helpers,
>
> I have a list containing 10 elements, each of which is a dataframe. I wish
> to add a new column to each list element (dataframe) containing the product
> of the last two columns of each dataframe.
>
> I'd appreciate any pointers, thanks!
>
> Mark Na
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to