This vignette demonstrates how exploratory functions like show_in_excel()
, which_na()
and which_this()
can be used.
Examples
df = iris
Show a data frame in MS Excel
show_in_excel(df)
It can also be used with pipes.
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
df %>%
show_in_excel()
Which values are missing?
I’m initialising a vector from 1 to 10 with fifth value as missing NA
.
x = c(1:4, NA, 6:10)
Using which_na()
, I can find index of element in the vector which is NA
.
which_na(x)
#> [1] 5
Which element is this?
It can identify values that satisfy a criteria. It is kind of a wrapper around dplyr’s filter().
which_this(iris, "Sepal.Length > 7")
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 7.1 3.0 5.9 2.1 virginica
#> 2 7.6 3.0 6.6 2.1 virginica
#> 3 7.3 2.9 6.3 1.8 virginica
#> 4 7.2 3.6 6.1 2.5 virginica
#> 5 7.7 3.8 6.7 2.2 virginica
#> 6 7.7 2.6 6.9 2.3 virginica
#> 7 7.7 2.8 6.7 2.0 virginica
#> 8 7.2 3.2 6.0 1.8 virginica
#> 9 7.2 3.0 5.8 1.6 virginica
#> 10 7.4 2.8 6.1 1.9 virginica
#> 11 7.9 3.8 6.4 2.0 virginica
#> 12 7.7 3.0 6.1 2.3 virginica