Skip to content
Prev 360497 / 398503 Next

Create a new variable and concatenation inside a "for" loop

Maybe I wasn't  clear  about my query. 

I'm very familiar with pre-allocation and vectorization and I had already wrote an R code for this problem in this way. My question wasn't about the most efficient way to solve the problem. It was about whether in R it was possible to use the same  index used in the loop to create a new variable and store the results in as in the example showed below. The use of ?c? was because I was using Matlab, otherwise I know that a new variable shouldn?t have the same name as the name of a function.

Regards,
Fabiana


-----Original Message-----
From: Bert Gunter [mailto:bgunter.4567 at gmail.com] 
Sent: 27 April 2016 21:18
To: Jeff Newmiller
Cc: Gordon, Fabiana; r-help at R-project.org
Subject: Re: [R] Create a new variable and concatenation inside a "for" loop

...

"(R is case sensitive, so "C" has no such problem)."

Well, not quite. Try ?C

To add to the previous comments, Dr. Gordon appears to need to do her/his homework and spend some time with an R tutorial or two before posting further here. There are many good ones on the web. Some recommendations can be found here:
https://www.rstudio.com/online-learning/#R

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Wed, Apr 27, 2016 at 12:57 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
Message-ID: <VI1PR06MB11658535EEBB722EB4DF63B3B2650@VI1PR06MB1165.eurprd06.prod.outlook.com>
In-Reply-To: <CAGxFJbTELNKOfz2-ximsCtxiy-pEA88u8WHDYXOU8=p8Z5vqJA@mail.gmail.com>