681/selecting-a-sublist-with-purrr
I have this list:
mylist=list(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10)
I want to select a sublist comprising of only "e","f" and "g" elements. Is there a function in the package purrr that would help me to do this?
Yes, purrr does provide a package called keep() to select only specific elements from the list. The below command solves your problem:
mylist %>% keep(names(.) == "e" | names(.) == "f" | names(.) == "g")
This would be your result:
$e [1] 5 $f [1] 6 $g [1] 7
With the help of Dplyr: rename function ...READ MORE
We can easily use this command as.data.frame(lapply(d1, "length< ...READ MORE
It is simple and easy: df1<-as.data.frame(matrix(sample(c(NA, 1:10), 100, ...READ MORE
Use dplyr function group_by(). > n = as.data.frame(num) > ...READ MORE
We would start off by loading the ...READ MORE
You can use the "dplyr" package to ...READ MORE
The below is the code to perform ...READ MORE
If you want to plot 4 graphs ...READ MORE
Try this. lapply(a,function(x){ifelse(is.na(x),mean(a,na.rm = TRUE ...READ MORE
Using Anaconda Python 3.6 version For Windows ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.