forked from reagro/carob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.R
52 lines (38 loc) · 1010 Bytes
/
template.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
# R script for "carob"
## ISSUES
# ....
carob_script <- function(path) {
"
Description:
[copy the abstract from the repo]
"
uri <- "doi:______"
dataset_id <- agro::get_simple_URI(uri)
group <- ""
## dataset level data
dset <- data.frame(
dataset_id = dataset_id,
group=group,
uri=uri,
publication="publication doi",
data_citation = "",
data_institutions = "",
carob_contributor="Your name",
experiment_type="___",
has_weather=FALSE,
has_management=FALSE
)
## download and read data
ff <- carobiner::get_data(uri, path, group)
js <- carobiner::get_metadata(dataset_id, path, group, major=2, minor=1)
dset$license <- carobiner::get_license(js)
f <- ff[basename(ff) == "_____________"]
d <- read.csv(f)
d <- readxl::read_excel(f) |> as.data.frame()
# process file(s)
d <- carobiner::change_names(d, from, to)
d$dataset_id <- dataset_id
# all scripts must end like this
carobiner::write_files(dset, d, path, dataset_id, group)
TRUE
}