如何使用降雪导出预定义函数? [英] How to export a predefined function using snowfall?

查看:72
本文介绍了如何使用降雪导出预定义函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用降雪包在4个内核中运行一些仿真.我使用了'mgcv'库及其'rmvn'函数来模拟用户定义函数中的一些多元数据.我在另一个用户定义的函数中调用了降雪包,并使用'sfExpotAll'导出了全局环境中的所有变量.但是它给出了一个错误,提示找不到函数" rmvn"".

然后我使用 sfExport('rmvn')分别导出它,但随后出现错误,提示导出时未知/未找到变量rmvn" ./p>

我想知道我在哪里弄错了.任何提示将不胜感激.

解决方案

如果要加载库,请使用:

  sfLibrary("mgcv") 

如果您要获取文件来源,请使用:

  sfSource(pathtofile) 

I was trying to run some simulations in 4 cores using snowfall package. I have used 'mgcv' library and its 'rmvn' function to simulate some multivariate data within a user defined function. I called snowfall package in another user defined function, and used 'sfExpotAll' to export all the variables in global environment. But it gave an error saying "could not find function "rmvn"".

Then I used sfExport('rmvn') to export it seperately, but then it gives an error saying, "Unknown/unfound variable rmvn in export".

I wonder where I have made the mistake. Any hint will be appreciated.

解决方案

If you want to load a library use:

sfLibrary("mgcv")

If you want to source a file use:

sfSource(pathtofile)

这篇关于如何使用降雪导出预定义函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆