R: Faster expand.grid

rxExpandGrid {RxODE} | R Documentation

## Faster expand.grid

### Description

Only support x and y as characters right now

### Usage

    rxExpandGrid(x, y, type = 0L)

### Arguments

`x` | first element (must be character)
`y` | second element (must be character)
`type` | Internal type=0L is traditional expand grid and type=1L is jacobian expand grid (adds symbols)

### Value

Expand grid

### Author(s)

Matthew Fidler

### Examples

    ##
    rxExpandGrid(letters, letters)

    ## Another fast method; See
    ## https://stackoverflow.com/questions/10405637/use-outer-instead-of-expand-grid

    expand.grid.jc <- function(seq1,seq2) {
     cbind(Var1 = rep.int(seq1, length(seq2)),
      Var2 = rep.int(seq2, rep.int(length(seq1),length(seq2))))
    }

     microbenchmark::microbenchmark(rxExpandGrid(letters, letters), expand.grid.jc(letters, letters))

[Package RxODE version 1.0.9 Index]