linux上带R的多核处理
我正试图使用R软件包pegas所涉及的程序进行Hardy Weinberg精确测试。我编写的代码对54个总体中的每一个应用了10^5个排列的测试,然后将p值结果写入单粒子矩阵。我使用for循环,使用下面的代码,一次一个地将该过程自动应用于所有54个POPlinux上带R的多核处理,r,linux,parallel-processing,multicore,R,Linux,Parallel Processing,Multicore,我正试图使用R软件包pegas所涉及的程序进行Hardy Weinberg精确测试。我编写的代码对54个总体中的每一个应用了10^5个排列的测试,然后将p值结果写入单粒子矩阵。我使用for循环,使用下面的代码,一次一个地将该过程自动应用于所有54个POP for(M in 1:nPop(cod)) { hw.result <- hw.test(cod[pop=M], B = 100000)# Carry out hw test on pop M HWE.matrix[,M] <- h
for(M in 1:nPop(cod))
{
hw.result <- hw.test(cod[pop=M], B = 100000)# Carry out hw test on pop M
HWE.matrix[,M] <- hw.result[,"Pr.exact"]# Feed results into the matrix
}
for(M/1:nPop(cod))
{
hw.result您是否阅读了安装R附带的“parallel”软件包的小插曲?我已经阅读了,因此掌握了集群的制作。我不完全理解它,并且很难确定哪些部分与我相关。我尝试了一些部分,但没有用。
foreach(i in 1:nPop(cod)) %dopar%
{
hw.result <- hw.test(cod[pop=i], B = 100000)# Carry out hw test on pop M
HWE.matrix[,i] <- hw.result[,"Pr.exact"]# Feed results into the matrix
}