# Select variables and filter data

Source: `R/radiant.R`
`get_data.Rd`

Select variables and filter data

    get_data(
      dataset,
      vars = "",
      filt = "",
      arr = "",
      rows = NULL,
      data_view_rows = NULL,
      na.rm = TRUE,
      rev = FALSE,
      envir = c()
    )

## Arguments

dataset

  Dataset or name of the data.frame

vars

  Variables to extract from the data.frame

filt

  Filter to apply to the specified dataset

arr

  Expression to use to arrange (sort) the specified dataset

rows

  Select rows in the specified dataset

data_view_rows

  Vector of rows to select. Only used by Data > View in Radiant. Users should use "rows" instead

na.rm

  Remove rows with missing values (default is TRUE)

rev

  Reverse filter and row selection (i.e., get the remainder)

envir

  Environment to extract data from

## Value

Data.frame with specified columns and rows

## Details

Function is used in radiant to select variables and filter data based on user input in string form

## Examples

    get_data(mtcars, vars = "cyl:vs", filt = "mpg > 25")
    #>                cyl  disp  hp drat    wt  qsec vs
    #> Fiat 128         4  78.7  66 4.08 2.200 19.47  1
    #> Honda Civic      4  75.7  52 4.93 1.615 18.52  1
    #> Toyota Corolla   4  71.1  65 4.22 1.835 19.90  1
    #> Fiat X1-9        4  79.0  66 4.08 1.935 18.90  1
    #> Porsche 914-2    4 120.3  91 4.43 2.140 16.70  0
    #> Lotus Europa     4  95.1 113 3.77 1.513 16.90  1
    get_data(mtcars, vars = c("mpg", "cyl"), rows = 1:10)
    #>                    mpg cyl
    #> Mazda RX4         21.0   6
    #> Mazda RX4 Wag     21.0   6
    #> Datsun 710        22.8   4
    #> Hornet 4 Drive    21.4   6
    #> Hornet Sportabout 18.7   8
    #> Valiant           18.1   6
    #> Duster 360        14.3   8
    #> Merc 240D         24.4   4
    #> Merc 230          22.8   4
    #> Merc 280          19.2   6
    get_data(mtcars, vars = c("mpg", "cyl"), arr = "desc(mpg)", rows = "1:5")
    #>                 mpg cyl
    #> Toyota Corolla 33.9   4
    #> Fiat 128       32.4   4
    #> Honda Civic    30.4   4
    #> Lotus Europa   30.4   4
    #> Fiat X1-9      27.3   4