如何在R中生成GUID? [英] How can I generate a GUID in R?
问题描述
如何在R中生成GUID和UUID?
How can I generate GUIDs and UUIDs in R?
我希望能够基于运行rsession的计算机的硬件等生成GUID.
I would like to be able to generate GUIDs based on the hardware etc. of the machine running the rsession.
但是,作为后备,我很乐意创建符合rfc4122的UUID.
As a fallback, however, I would be happy to create UUIDs that comply with rfc4122.
是否有可以创建GUID的软件包?否则,有人会在附近散布一些与RFC4122兼容的UUID代码吗?
Is there a package that can create GUIDs? Otherwise, does someone have some RFC4122 compatible UUID code lying about?
推荐答案
为此的最佳选择是uuid
软件包.它由一个函数(UUIDgenerate
)组成,该函数不依赖R的内部随机数生成器,因此不会像@thelatemail的答案那样在会话中使用set.seed
带来任何后果.您可以选择由程序包的内部随机数生成器或根据时间生成UUID.
The optimal choice for this now is the uuid
package. It consists of one function (UUIDgenerate
) that doesn't rely on R's internal random number generators and so doesn't suffer any consequences from using set.seed
in a session as @thelatemail's answer does. You can choose to have the UUID be generated either by the package's internal random number generator or based on time.
这篇关于如何在R中生成GUID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!