get_uuid: Generate a vector of Version 4 UUIDs (RFC 4122)

Description Usage Arguments Examples

View source: R/data_manipulation.R

Description

This function is being deprecated in favor of directly using the UUIDgenerate() function from Simon Urbanek's uuid package. The updated UUIDgenerate() function now generates vectors of proper version 4 random UUIDs in a Windows environment. The previous version of the get_uuid() relied on the dplR::uuid_gen() function, This has now been replaced by uuid::UUIDgenerate(). The current version of get_uuid() can be used as a drop-in replacement for the previous verison, but it is orders of magnitude faster. It is retained here strictly to avoid introducing any breaking changes in existing code. For any new code, please use UUIDgenerate().

Usage

1
get_uuid(n = 1L)

Arguments

n

Number of UUIDs to generate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Create example data frame
library(dplyr)
dat = tibble::tibble(survey_date = c("2019-05-10",
                                    "2019-05-12",
                                    "2019-05-14"),
                    species = c("chinook",
                                "chum",
                                "pink"),
                    fish_count = c(3, 5, 25))

# One UUID per row
dat = dat %>%
  mutate(survey_id = remisc::get_uuid(n = nrow(dat))) %>%
  select(survey_id, survey_date, species, fish_count)

# Create example data frame
library(dplyr)
dat = tibble::tibble(survey_date = c("2019-05-10",
                                    "2019-05-10",
                                    "2019-05-14",
                                    "2019-05-14",
                                    "2019-05-18"),
                    species = c("chinook",
                                "chinook",
                                "coho",
                                "chum",
                                "pink"),
                    fish_count = c(3, 5, 8, 6, 25))

# One UUID per group
dat = dat %>%
  group_by(survey_date) %>%
  mutate(survey_id = remisc::get_uuid()) %>%
  ungroup() %>%
  select(survey_id, survey_date, species, fish_count)

arestrom/remisc documentation built on July 16, 2020, 8:48 a.m.