Listing all models {-}

We can list the first 10 models using the getSearchResult function.

library(ddmore.repository)
library(dplyr)
library(magrittr)
library(purrr)
myModels <- getSearchResult(offset=0)
as.data.frame(myModels)

To load all models, search without a query.

allModels <- getSearchResult(all=TRUE) %>% as.data.frame()
allModels %>% dplyr::filter(format=="Original code") %>% head()

A specific model can be loaded with the getModel() function

foo <- getModel(allModels$id[1])

You can download all the files for this model using the saveFiles() function.

tmp <- tempdir()
saveFiles(foo, destination=tmp)

As an example for downloading all files in the DDMoRe repository:

allModels <- getSearchResult(all=TRUE) %>% as.data.frame()
pb <- dplyr::progress_estimated(n=nrow(allModels))
allModels$id %>% purrr::map(getModel) %>% purrr::map(function(x) {
  saveFiles(x, x$identifier)
  pb$tick()$print()
  })

Code appendix




rfaelens/ddmore.repository documentation built on Nov. 5, 2019, 2:55 p.m.