-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include 'job_info_df' as part of the package, and describe its creati…
…on in a conventional way as recommended at https://r-pkgs.org/data.html#sec-data-data-raw
- Loading branch information
1 parent
48b364f
commit e7ddc68
Showing
5 changed files
with
15 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
^README\.Rmd$ | ||
^\.github$ | ||
^codecov\.yml$ | ||
^data-raw$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,6 @@ Imports: | |
stringr, | ||
purrr, | ||
utils | ||
Depends: | ||
R (>= 2.10) | ||
LazyData: true |
17 changes: 7 additions & 10 deletions
17
dev/interactive_testing/clean_job_info.R → data-raw/job_info_df.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,26 @@ | ||
library(here) | ||
library(dplyr) | ||
library(stringr) | ||
source(here('R', 'job_info.R')) | ||
|
||
# Randomly grab 100 jobs running now on the 'shared' partition | ||
job_df = job_info(user = NULL) |> | ||
job_info_df = job_info(user = NULL) |> | ||
sample_n(size = 100) |> | ||
arrange(job_id) | ||
|
||
# A vector whose values are anonymous usernames and whose names are the | ||
# original usernames | ||
user_map = paste0('user', 1:length(unique(job_df$user))) | ||
names(user_map) = unique(job_df$user) | ||
user_map = paste0('user', 1:length(unique(job_info_df$user))) | ||
names(user_map) = unique(job_info_df$user) | ||
|
||
# Similarly for job names, though we'll keep the generic name for interactive | ||
# jobs ('bash') | ||
name_map = paste0('my_job_', 1:length(unique(job_df$name))) | ||
names(name_map) = unique(job_df$name) | ||
name_map = paste0('my_job_', 1:length(unique(job_info_df$name))) | ||
names(name_map) = unique(job_info_df$name) | ||
name_map['bash'] = 'bash' | ||
|
||
# Anonymize username and job name | ||
job_df = job_df |> | ||
job_info_df = job_info_df |> | ||
mutate( | ||
user = user_map[user], | ||
name = name_map[name] | ||
) | ||
|
||
saveRDS(job_df, here('inst', 'extdata', 'job_info_df.rds')) | ||
usethis::use_data(job_info_df, overwrite = TRUE) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters