[R] Loop removal possible? (fwd)

Peter Malewski malewski.peter at mh-hannover.de
Mon Aug 21 14:08:49 CEST 2000


> with weighting the expanded x vector looks like
> "position"      x[i]
> 1               10
> 2               10
> 3               40
> 4               50
> 5               50
> 6               50
> 7               100
> 8               100

x<-c(10,40,50,100)  # income vector for instance
w<-c(2,1,3,2)       # the weight for each observation in x with the same
length
rep(x,w)
[1]  10  10  40  50  50  50 100 100


...should do
P.


-- 



---------------------------------------------------
* P. Malewski									
* Hannover Medical School						
* Department of Psychosomatics and Psychotherapy
* Carl-Neuberg-Str. 1  							
* Tel.:+49 511 532 3194							
* Fax.:+49 511 532 3190							
---------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list