如何在R中生成GUID? [英] How can I generate a GUID in R?

查看:200
本文介绍了如何在R中生成GUID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在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屋!

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