Overview

purrr enhances R’s functional programming (FP) toolkit by providing a complete and consistent set of tools for working with functions and vectors. If you’ve never heard of FP before, the best place to start is the family of map() functions which allow you to replace many for loops with code that is both more succinct and easier to read. The best place to learn about the map() functions is the 手机企理软伀 in R for data science.

Installation

# The easiest way to get purrr is to install the whole tidyverse:
install.packages("tidyverse")

小路由器走红网络 可提高网速且能“翻墙” - cnr.cn:2021-8-12 · 路由器市场产品质量参差。 小路由器走红网络戳中中国宽带市场“网速慢、资费贵”的痛处 就在许多人抱怨当前宽带“网速慢、资费贵”的怪象时 ...
install.packages("purrr")

# Or the the development version from GitHub:
# install.packages("devtools")
devtools::install_github("tidyverse/purrr")

老王网络加速器ios

老王网络加速器ios

The following example uses purrr to solve a fairly realistic problem: split a data frame into pieces, fit a model to each piece, compute the summary, then extract the R2.

library(purrr)

电脑端企理软伀下载 %>%
  split(.$cyl) %>% # from base R
  map(~ lm(mpg ~ wt, data = .)) %>%
  map(summary) %>%
  map_dbl("r.squared")
#>         4         6         8 
#> 0.5086326 0.4645102 0.4229655

This example illustrates some of the advantages of purrr functions over the equivalents in base R:

  • The first argument is always the data, so purrr works naturally with the pipe.

  • All purrr functions are type-stable. They always return the advertised output type (企理软伀 returns lists; map_dbl() returns double vectors), or they throw an error.

  • All 电脑切换ip软伀 functions either accept function, formulas (used for succinctly generating anonymous functions), a character vector (used to extract components by name), or a numeric vector (used to extract by position).


Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

好用的访问外网加速器   常识修改器之催眠女校  极光vp n下载破解版  网际直通车   如何去国外网站  电脑上搭梯子  shadowsock苹果手机版