refer to them before and during live coding while teaching STAT 545 and DSCI 523 don’t expect them to stand on their own more material developing here:
substring starts, pos of substring ends) extract the substrings and give me a list of character vectors https://jennybc.github.io/purrr-tutorial/ex10_trump-tweets.html
with purrr that you cannot do with base specifically: map() is basically lapply() main reasons to use purrr: - shortcuts facilitate anonymous functions for .f - greater encouragement for type-safety - consistent API across large family of functions
a data frame when possible what about stuff that can’t be stored as an atomic vector? - stick it in a list-column but list-columns are awful! - get better at inspecting lists - get better at computing on lists use purrr::map() and friends - probably inside dplyr::mutate()
a data frame when possible ok there’s a whole section I want to write here, with more worked examples on the site, etc. but that’s not happening this round what follows are a few hints of the what I will say
list, but also access the index i or the list names at the same time? they should probably be working inside a data frame, with a list column and a variable for i or the names use tibble::enframe() on your vexing_list and have at it with mutate(new_var = map_*(vexing_list, f)) or map2() or pmap()
Gapminder materials (translate from plyr and dplyr) natural to nest at country level and put data in list-column fit models, etc. by mutating the data list-column extract model summaries by mutating the fits w broom fxns
mind enjoys having list-columns in a data frame but the benefits often outweigh the costs especially if you have the right tools and a productive mindset it’s always a temporary state goal is always to get back to something simpler
P.M. Enjoy! Join me in Fayetteville, North Carolina tomorrow evening at 6pm. Tickets now available at: https://t.co/Z80d4MYIg8 The media is going crazy. They totally distort so many things on purpose. Crimea, nuclear, "the baby" and so much more. Very dishonest! I see where Mayor Stephanie Rawlings-Blake of Baltimore is pushing Crooked hard. Look at the job she has done in Baltimore. She is a joke! Bernie Sanders started off strong, but with the selection of Kaine for V.P., is ending really weak. So much for a movement! TOTAL DISRESPECT Crooked Hillary Clinton is unfit to serve as President of the U.S. Her temperament is weak and her opponents are strong. BAD JUDGEMENT! The Cruz-Kasich pact is under great strain. This joke of a deal is falling apart, not being honored and almost dead. Very dumb! substring(text, first, last) [[1]] [1] -1 [[2]] [1] -1 [[3]] [1] 20 [[4]] [1] 134 [[5]] [1] 28 95 [[6]] [1] 87 114 [[7]] [1] 50 112 123 [[1]] [1] -3 [[2]] [1] -3 [[3]] [1] 24 [[4]] [1] 137 [[5]] [1] 33 98 [[6]] [1] 90 119 [[7]] [1] 53 115 126 tweets match_first match_last https://jennybc.github.io/purrr-tutorial/ex10_trump-tweets.html pmap(list(text = tweets, first = match_first, last = match_last), substring)