Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
 
 
man
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

select4lists

Dplyr’s select() for named lists.

Installation

You can install select4lists from github with:

# install.packages("devtools")
devtools::install_github("Athospd/select4lists")

Dplyr functions implemented

  • select()
  • rename()

Example

library(dplyr)
library(select4lists)
iris_as_list <- as.list(iris %>% head)

iris_as_list %>% select(Species)
#> $Species
#> [1] setosa setosa setosa setosa setosa setosa
#> Levels: setosa versicolor virginica
iris_as_list %>% select(starts_with("Sepal"))
#> $Sepal.Length
#> [1] 5.1 4.9 4.7 4.6 5.0 5.4
#> 
#> $Sepal.Width
#> [1] 3.5 3.0 3.2 3.1 3.6 3.9
iris_as_list %>% select(2:3)
#> $Sepal.Width
#> [1] 3.5 3.0 3.2 3.1 3.6 3.9
#> 
#> $Petal.Length
#> [1] 1.4 1.4 1.3 1.5 1.4 1.7
iris_as_list %>% select(-contains("."))
#> $Species
#> [1] setosa setosa setosa setosa setosa setosa
#> Levels: setosa versicolor virginica