-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_data.R
65 lines (54 loc) · 1.67 KB
/
make_data.R
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# ---------------------------------------------------------------------------- #
# This file generates and updates the provided package data "burngrading01".
#
loc <- fs::path("media")
fs::dir_create(loc)
ruODK::ru_setup(
svc = "https://ruodk.getodk.cloud/v1/projects/1/forms/burn_grading_forest.svc",
un = Sys.getenv("RUODK_UN"),
pw = Sys.getenv("RUODK_PW")
)
bgf <- ruODK::odata_submission_get(
verbose = TRUE,
tz = "Australia/Perth",
local_dir = loc,
wkt = T,
top = 10
)
ruODK::ru_setup(
svc = "https://ruodk.getodk.cloud/v1/projects/1/forms/burn_grading_heath.svc",
un = Sys.getenv("RUODK_UN"),
pw = Sys.getenv("RUODK_PW")
)
bgh <- ruODK::odata_submission_get(
verbose = TRUE,
tz = "Australia/Perth",
local_dir = loc,
wkt = T,
top = 10
)
ruODK::ru_setup(
svc = "https://ruodk.getodk.cloud/v1/projects/1/forms/burn_grading_verify.svc",
un = Sys.getenv("RUODK_UN"),
pw = Sys.getenv("RUODK_PW")
)
bgv <- ruODK::odata_submission_get(
verbose = TRUE,
tz = "Australia/Perth",
local_dir = loc,
wkt = T,
top = 10
)
# Resize images to minimise package size
# This works only under Linux based OS
# sudo apt install imagemagick
system("find media -name *.jpg -exec mogrify -resize 200x150 {} \\;")
# Update vignette "analysis" header with:
ymlthis::yml_resource_files(ymlthis::yml(), fs::dir_ls(loc))
# Move files where header expects them
fs::dir_copy(loc, here::here("vignettes/media"), overwrite = TRUE)
# fs::dir_delete(loc)
# usethis::use_data(burngrading01, overwrite = T, compress = "xz")
usethis::use_data(bgf, overwrite = T, compress = "xz")
usethis::use_data(bgh, overwrite = T, compress = "xz")
usethis::use_data(bgv, overwrite = T, compress = "xz")