[R] Help R - SNOW package...correct indexation syntax??

Ron Piccinini ronpicci at yahoo.fr
Tue Jul 27 16:21:09 CEST 2004


Hello!

I am trying to apply estimators at various data
lengths (data is resident on diferent nodes of a
beowulf cluster) in order to save computation time. 

On one side, suppose that:
x <- clusterCall(cl,runif,100000)
(i.e. 100,000 random numbers on each node)
then the first say 100 numbers of node say #3 are
returned by x.3.100 <- x[[3]][1:100]

On the other side, if one wanted to compute the
average of each series individually, one could use:
x.averages <- parSapply(cl,x,mean)

But what if one wanted to to compute the average of
only the first 100 data points resident on each node?
What would be the approriate syntax? Is the only (and
fastest) solution to write a loop of the type:

for (j in numbernodes){x.avearges.100 <-
mean(x[[j]][1:100]}

Or is there a more efficient par_apply method? I've
been trying and trying to find a better way
unfortunately to no avail. 

Thanks in advance for your time and help,

Renaud Piccinini
University of Nebraska-Lincoln




	

	
		
Vous manquez d’espace pour stocker vos mails ?




More information about the R-help mailing list