Add an analysis to a study object
add_analysis(
study,
id = NULL,
code = "",
return = "",
type = c("func", "text", "file"),
...
)
A study list object with class scivrs_study
The id for this analysis (index or character) if an analysis with this id already exists, it will overwrite it
The code to run or a file name containing the code
A list of object names to return from the code
Whether the code is a function, text, or file name
further arguments to add
A study object with class scivrs_study
s <- study() %>%
add_hypothesis("H1", "Petal width and length will be positively correlated.") %>%
add_analysis("A1", cor.test(dat$Petal.Width, dat$Petal.Length))
study_to_json(s)
#> {
#> "name": "Demo Study",
#> "info": [],
#> "authors": [],
#> "hypotheses": [
#> {
#> "id": "H1",
#> "description": "Petal width and length will be positively correlated.",
#> "criteria": [],
#> "corroboration": [],
#> "falsification": []
#> }
#> ],
#> "methods": [],
#> "data": [],
#> "analyses": [
#> {
#> "id": "A1",
#> "code": "cor.test(dat$Petal.Width, dat$Petal.Length)"
#> }
#> ]
#> }
#>