Yes, R is a different language, and has different syntax and different
built-in functions, so, yes it works differently.
If you want to do it the same way in R as in that other language, you have
to use a different method for constructing the variable names inside the
loop. Here's an example, usin
HI,
If you have more than one observation per month, you could do this:
dat1<-read.table(text="
Year Month Sales Customer
2011 Jan 150 35
2011 Jan 125 40
2011 Feb 130 45
2011 Feb 135 25
2012 Jan 100 25
2012 Jan 150 35
2012 Feb
Hi Paolo,
You say you have monthly observations of two variables, say Sales and
Customers.
Then, what you should have is something like this:
Year Month Sales Customer
2012Jan ss_12.1 cc_12.1
2012Feb ss_12.2 cc_12.2
... ... ... ...
2013Jan ss_13.1
Hi
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Paolo Donatelli
> Sent: Wednesday, January 09, 2013 5:03 PM
> To: r-help@r-project.org
> Subject: [R] Basic loop programming
>
> Hi all,
>
> newbie question: I am trying to
4 matches
Mail list logo