Add an analysis to a study object

add_analysis(
  study,
  id = NULL,
  code = "",
  return = "",
  type = c("func", "text", "file"),
  ...
)

Arguments

study

A study list object with class scivrs_study

id

The id for this analysis (index or character) if an analysis with this id already exists, it will overwrite it

code

The code to run or a file name containing the code

return

A list of object names to return from the code

type

Whether the code is a function, text, or file name

...

further arguments to add

Value

A study object with class scivrs_study

Examples

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)" #> } #> ] #> } #>