R/loadData.R

Defines functions loadData

loadData <- function(analysis){
  if (class(analysis) == 'Binalysis') {
    ld <- '

```{r loadData,echo=FALSE}
binalysis <- read_rds("reportData.rds")
```

'
  }
  if (class(analysis) == 'Analysis') {
    ld <- '

```{r loadData,echo=FALSE}
analysis <- read_rds("reportData.rds")
```

'
  }
  if (class(analysis) == 'Workflow') {
    ld <- str_c('

```{r loadData,echo=FALSE}
workflowData <- read_rds("reportData.rds")',
    if ('spectralBin' %in% analysis@flags) {
      '
binalysis <- workflowData %>%
                        resultsProcessing()'
    },
    if ('preTreat' %in% analysis@flags) {
      '
analysis <- workflowData %>%
                        resultsAnalysis()'
    },
    if ('annotation' %in% analysis@flags) {
      '
assignment <- workflowData %>%
      resultsAnnotation()'
    },
    '
```
    
')
  }
  if (class(analysis) == 'Assignment') {
    ld <- '

```{r loadData,echo=FALSE}
assignment <- read_rds("reportData.rds")
```

'
  }
  return(ld)
}
jasenfinch/metaboReports documentation built on Aug. 11, 2018, 1:06 p.m.