[R] A coding question

xpRt.wannabe xprt.wannabe at gmail.com
Fri Jun 2 01:22:25 CEST 2006


Dear List:

I have the follow code:

y <- replicate(10,replicate(8,sum(rnorm(rpois(1,5)))))

Now I need to apply the following condition to _every_ randomly generated
Normal number in the code above:

x - max(0,x-15) + max(0,x-90), where x represents the individual Normal
numbers.

In other words, the said condition needs to be applied before
replicate(...(replicate(...(sum(...))) takes place.

Any help would be greatly appreciated.


platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 2.1
year 2005
month 12
day 20
svn rev 36812
language R



More information about the R-help mailing list