Select variables and filter data
get_data(dataset, vars = "", filt = "", rows = NULL, na.rm = TRUE, envir = c())
dataset | Dataset or name of the data.frame |
---|---|
vars | Variables to extract from the data.frame |
filt | Filter to apply to the specified dataset |
rows | Select rows in the specified dataset |
na.rm | Remove rows with missing values (default is TRUE) |
envir | Environment to extract data from |
Data.frame with specified columns and rows
Function is used in radiant to select variables and filter data based on user input in string form
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#> 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