Re: [R] Creating new columns inside a loop

From: Peter Dalgaard <>
Date: Thu 11 Aug 2005 - 05:55:01 EST

"David L. Van Brunt, Ph.D." <> writes:

> Ok, I know R isn't an optimal environment for looping (or so I've heard) but
> I have a need to loop through columns of data and create new columns of data
> based on calculations within rows...
> I'm sure there's a help file, but I'm not sure what search terms to use to
> find it! The problem is that these new columns need to have names that I can
> later access... Like NewVar1, NewVar2, etc....
> In php I'd call this "indirection" but I'm not sure what to call it in R so
> that I can find instructions on how to create, name, and address the values
> stored this way...
> any gentle nudges in the right direction would be greatly appreciated!

A little more information about what you're actually trying to do and I'm sure someone will give you a nudge with a sledgehammer...

At present, your description is just that little bit too nebulous.

   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (                  FAX: (+45) 35327907

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Thu Aug 11 05:57:45 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:45 EST