English 中文(简体)
如何在雪上产生信息?
原标题:How to output a message in snowfall?
  • 时间:2012-01-14 05:55:37
  •  标签:
  • r
  • snowfall

我正在通过视窗7的降雪包进行模拟研究。

我每10天向R console主发布一个信息,以监测进展情况,但未能这样做。 页: 1 页: 1

任何帮助都将受到高度赞赏。

runsim = function(nsim,n,mean,var){
cov = 0
for(i in 1:nsim){
if ( i %% 10==0) 
cat("
 Running simulation",i)
dat = function1(n,mean,var)

cov = ...
}
cov / nsim
}
sfExport("function1","runsim")
sfLibrary(library1)

wrapper = function(n){
runsim(100,n,0.5,0.25)
}

Out<-sfLapply(1:100,wrapper)
最佳回答

<代码>? a. 甲型六氯环己烷/甲型六氯环己烷

iii Cat是一种 de缩的职能,它印刷了有关所有奴隶的信息(见记录表)。

这告诉我们,我们需要能够在“sfInit(argumentslaveOutfile)上进行伐木。 然后,每打sfCat()的电话将 st上你指定的记录。 我只想一提一下。

Code Example

if (!require("snowfall")) {
    install.packages("snowfall")
    require("snowfall")
}

sfInit(parallel=TRUE, cpus=4, slaveOutfile="test.txt")
sfLibrary("snowfall", character.only=TRUE)

res <- sfClusterApplyLB(1:100, function(x) {
    sfCat(paste("Iteration ", x), sep="
")
})
sfStop()

Output of ./test.txt

[...]

Calling a snowfall function without calling  sfInit  first or after sfStop().
 sfInit()  is called now.
snowfall 1.84 initialized: sequential execution, one CPU.

Iteration  4
Type: EXEC 
Iteration  92
Type: EXEC 
Iteration  94
Type: EXEC 
Iteration  96
Type: EXEC 
Iteration  98
Type: EXEC 
Iteration  100
ype: EXEC 
Iteration  29
Type: EXEC 
Iteration  31
Type: EXEC 
Iteration  33
Type: EXEC 
Iteration  35
Type: EXEC 
Iteration  37
Type: EXEC 
Iteration  39
Type: EXEC 
Iteration  41
Type: EXEC 
Iteration  43
Type: EXEC 
Iteration  45
Type: EXEC 
Iteration  47
Type: EXEC 
Iteration  49
Type: EXEC 
Iteration  51
Type: EXEC 
Iteration  53
Type: EXEC 
Iteration  55
Type: EXEC 
Iteration  57
Type: EXEC 
Iteration  59
Type: EXEC 
Iteration  61
Type: EXEC 
Iteration  63
Type: EXEC 
Iteration  65
Type: EXEC 
Iteration  67
Type: EXEC 
Iteration  69
Type: EXEC 
Iteration  71
Type: EXEC 
Iteration  73
Type: EXEC 
Iteration  75
Type: EXEC 
Iteration  77
Type: EXEC 
Iteration  79
Type: EXEC 
Iteration  81
Type: EXEC 
Iteration  83
Type: EXEC 
Iteration  85
Type: EXEC 
Iteration  87
Type: EXEC 
Iteration  89
Type: EXEC 
Iteration  91
Type: EXEC 
Iteration  93
Type: EXEC 
Iteration  95
Type: EXEC 
Iteration  97
Type: EXEC 
Iteration  99
 EXEC 
Iteration  74
Type: EXEC 
Iteration  76
Type: EXEC 
Iteration  78
Type: EXEC 
Iteration  80
Type: EXEC 
Iteration  82
Type: EXEC 
Iteration  84
Type: EXEC 
Iteration  86
Type: EXEC 
Iteration  88
Type: EXEC 
Iteration  90

Own question

Does anyone have a clue how to "control" the specific things that go to the log file? E.g., what would be nice is to include information about which worker finished which job etc.

问题回答

暂无回答




相关问题
How to plot fitted model over observed time series

This is a really really simple question to which I seem to be entirely unable to get a solution. I would like to do a scatter plot of an observed time series in R, and over this I want to plot the ...

REvolution for R

since the latest Ubuntu release (karmic koala), I noticed that the internal R package advertises on start-up the REvolution package. It seems to be a library collection for high-performance matrix ...

R - capturing elements of R output into text files

I am trying to run an analysis by invoking R through the command line as follows: R --no-save < SampleProgram.R > SampleProgram.opt For example, consider the simple R program below: mydata =...

R statistical package: wrapping GOFrame objects

I m trying to generate GOFrame objects to generate a gene ontology mapping in R for unsupported organisms (see http://www.bioconductor.org/packages/release/bioc/vignettes/GOstats/inst/doc/...

Changing the order of dodged bars in ggplot2 barplot

I have a dataframe df.all and I m plotting it in a bar plot with ggplot2 using the code below. I d like to make it so that the order of the dodged bars is flipped. That is, so that the bars labeled "...

Strange error when using sparse matrices and glmnet

I m getting a weird error when training a glmnet regression. invalid class "dgCMatrix" object: length(Dimnames[[2]]) must match Dim[2] It only happens occasionally, and perhaps only under larger ...

Generating non-duplicate combination pairs in R

Sorry for the non-descriptive title but I don t know whether there s a word for what I m trying to achieve. Let s assume that I have a list of names of different classes like c( 1 , 2 , 3 , 4 ) ...

Per panel smoothing in ggplot2

I m plotting a group of curves, using facet in ggplot2. I d like to have a smoother applied to plots where there are enough points to smooth, but not on plots with very few points. In particular I d ...

热门标签