[R] vector decreasing by a factor
Uwe Ligges
ligges at statistik.tu-dortmund.de
Mon May 2 10:51:31 CEST 2011
On 02.05.2011 09:55, andre bedon wrote:
>
> Hi,
> I'm quite new to R so this question will sound quite fundamental. I need to create a vector of length 160. The first element should be (1+r)^159 and each element thereafter should decrease by a factor of (1+r) until the 160th element that should be 1. Is there a function similar to seq() but increasing or decreasing by factors? I need to do this in one step i.e, not using loops. Any help would be greatly appreciated.
Yes:
(1+r)^(159:0)
Uwe Ligges
> Regards,
> Andre
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list