Giter VIP home page Giter VIP logo

purrrlyr's Introduction

purrrlyr

Lifecycle: superseded CRAN_Status_Badge Codecov test coverage R-CMD-check

purrrlyr contains some functions that lie at the intersection of purrr and dplyr. They have been removed from purrr in order to make the package lighter and because they have been replaced by other solutions in the tidyverse.

Please see Jenny Brian's webinar on row-oriented workflows for some alternative approaches.

purrrlyr's People

Contributors

1danjordan avatar artemklevtsov avatar benmarwick avatar burchill avatar coolbutuseless avatar davharris avatar dgromer avatar dpprdan avatar emojiencoding avatar hadley avatar jimhester avatar jrnold avatar krlmlr avatar lionel- avatar michaelquinn32 avatar michaelweylandt avatar mikelove avatar msonnabaum avatar noahmarconi avatar pierucci avatar rvjosh avatar sjackman avatar smbache avatar tjmahr avatar vspinu avatar wibeasley avatar yutannihilation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

purrrlyr's Issues

collate="rows" strips Date objects into numeric

library(tidyverse)
library(purrrlyr)

data("storms")

storms %>% 
    head(100) %>% 
    mutate(Date = as.Date(paste0(year, "-", month, "-", day))) %>% 
    by_row(function(.d) {select(.d, Date)}, .to = "new", .collate = "rows")

which yeilds:

# tibble [100 × 16]
   name   year month   day  hour   lat  long status              category  wind pressure ts_diameter hu_diameter Date        .row  Date
   <chr> <dbl> <dbl> <int> <dbl> <dbl> <dbl> <chr>               <ord>    <int>    <int>       <dbl>       <dbl> <date>     <int> <dbl>
 1 Amy    1975  6.00    27  0     27.5 -79.0 tropical depression -1          25     1013          NA          NA 1975-06-27     1  2003
 2 Amy    1975  6.00    27  6.00  28.5 -79.0 tropical depression -1          25     1013          NA          NA 1975-06-27     2  2003
 3 Amy    1975  6.00    27 12.0   29.5 -79.0 tropical depression -1          25     1013          NA          NA 1975-06-27     3  2003
 4 Amy    1975  6.00    27 18.0   30.5 -79.0 tropical depression -1          25     1013          NA          NA 1975-06-27     4  2003
 5 Amy    1975  6.00    28  0     31.5 -78.8 tropical depression -1          25     1012          NA          NA 1975-06-28     5  2004
 6 Amy    1975  6.00    28  6.00  32.4 -78.7 tropical depression -1          25     1012          NA          NA 1975-06-28     6  2004
 7 Amy    1975  6.00    28 12.0   33.3 -78.0 tropical depression -1          25     1011          NA          NA 1975-06-28     7  2004
 8 Amy    1975  6.00    28 18.0   34.0 -77.0 tropical depression -1          30     1006          NA          NA 1975-06-28     8  2004
 9 Amy    1975  6.00    29  0     34.4 -75.8 tropical storm      0           35     1004          NA          NA 1975-06-29     9  2005
10 Amy    1975  6.00    29  6.00  34.0 -74.8 tropical storm      0           40     1002          NA          NA 1975-06-29    10  2005
# ... with 90 more rows

but Date column should be of Date class.

Fails on dplyr 0.8.0

details below. I don't yet know what this is about.

> revdepcheck::revdep_details(revdep = "purrrlyr")
══ Reverse dependency check ═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ purrrlyr 0.0.3 ══

Status: BROKEN

── Newly failing

✖ checking examples ... ERROR
✖ checking tests ...

── Before ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
0 errors ✔ | 0 warnings ✔ | 0 notes ✔

── After ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ checking examples ... ERROR
  Running examples in ‘purrrlyr-Ex.R’ failed
  The error most likely occurred in:
  
  > ### Name: by_slice
  > ### Title: Apply a function to slices of a data frame
  > ### Aliases: by_slice
  > 
  > ### ** Examples
  > 
  > # Here we fit a regression model inside each slice defined by the
  > # unique values of the column "cyl". The fitted models are returned
  > # in a list-column.
  > mtcars %>%
  +   slice_rows("cyl") %>%
  +   by_slice(purrr::partial(lm, mpg ~ disp))
  # tibble [0 × 1]
  # ... with 1 variable: .out <list>
  > 
  > # by_slice() is especially useful in combination with map().
  > 
  > # To modify the contents of a data frame, use rows collation. Note
  > # that unlike dplyr, Mutating and summarising operations can be
  > # used indistinctly.
  > 
  > # Mutating operation:
  > df <- mtcars %>% slice_rows(c("cyl", "am"))
  > df %>% by_slice(dmap, ~ .x / sum(.x), .collate = "rows")
  Error in by_slice(., dmap, ~.x/sum(.x), .collate = "rows") : 
    results are all NULL and can't be cols/rows collated
  Calls: %>% ... _fseq -> freduce -> withVisible -> <Anonymous> -> by_slice
  Execution halted

❯ checking tests ...
  See below...

── Test failures ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── testthat ────

> library(testthat)
> library(purrrlyr)
> 
> test_check("purrrlyr")
── 1. Error: dmap() works with sliced data frames (@test-dmap.R#9)  ────────────
results are all NULL and can't be cols/rows collated
1: dmap(df, mean) at testthat/test-dmap.R:9
2: sliced_dmap(.d, .f, ...) at /Users/romain/git/release/dplyr/revdep/checks.noindex/purrrlyr/new/purrrlyr.Rcheck/00_pkg_src/purrrlyr/R/dmap.R:30

── 2. Error: dmap() works with no columns to map (@test-dmap.R#15)  ────────────
results are all NULL and can't be cols/rows collated
1: mtcars["cyl"] %>% slice_rows("cyl") %>% dmap(mean) at testthat/test-dmap.R:15
2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
3: eval(quote(`_fseq`(`_lhs`)), env, env)
4: eval(quote(`_fseq`(`_lhs`)), env, env)
5: `_fseq`(`_lhs`)
6: freduce(value, `_function_list`)
7: withVisible(function_list[[k]](value))
8: function_list[[k]](value)
9: dmap(., mean)
10: sliced_dmap(.d, .f, ...) at /Users/romain/git/release/dplyr/revdep/checks.noindex/purrrlyr/new/purrrlyr.Rcheck/00_pkg_src/purrrlyr/R/dmap.R:30

── 3. Error: conditional sliced mapping recycles within groups (@test-dmap.R#26)
results are all NULL and can't be cols/rows collated
1: by_slice(df, dmap, mean, .collate = "rows") at testthat/test-dmap.R:26

── 4. Error: empty data frames (@test-rows.R#154)  ─────────────────────────────
results are all NULL and can't be cols/rows collated
1: by_slice(grouped, empty_dataframes, .collate = "rows") at testthat/test-rows.R:154

── 5. Error: some empty data frames (@test-rows.R#166)  ────────────────────────
results are all NULL and can't be cols/rows collated
1: by_slice(grouped, some_empty_dataframes, .collate = "rows") at testthat/test-rows.R:166

── 6. Failure: by_slice() works with slicers of different types (@test-rows.R#20
typeof(out1$cyl) not equal to "double".
1/1 mismatches
x[1]: "NULL"
y[1]: "double"

── 7. Failure: by_slice() works with slicers of different types (@test-rows.R#20
typeof(out2$cyl) not equal to "character".
1/1 mismatches
x[1]: "NULL"
y[1]: "character"

── 8. Error: by_slice() does not create .row column (@test-rows.R#214)  ────────
results are all NULL and can't be cols/rows collated
1: by_slice(data, function(x) 1:3, .collate = "rows") at testthat/test-rows.R:214

── 9. Failure: error is thrown when no columns to map (@test-rows.R#233)  ──────
`mtcars["cyl"] %>% slice_rows("cyl") %>% by_slice(list)` did not throw an error.

══ testthat results  ═══════════════════════════════════════════════════════════
OK: 66 SKIPPED: 0 FAILED: 9
1. Error: dmap() works with sliced data frames (@test-dmap.R#9) 
2. Error: dmap() works with no columns to map (@test-dmap.R#15) 
3. Error: conditional sliced mapping recycles within groups (@test-dmap.R#26) 
4. Error: empty data frames (@test-rows.R#154) 
5. Error: some empty data frames (@test-rows.R#166) 
6. Failure: by_slice() works with slicers of different types (@test-rows.R#207) 
7. Failure: by_slice() works with slicers of different types (@test-rows.R#208) 
8. Error: by_slice() does not create .row column (@test-rows.R#214) 
9. Failure: error is thrown when no columns to map (@test-rows.R#233) 

Error: testthat unit tests failed
Execution halted

2 errors ✖ | 0 warnings ✔ | 0 notes ✔

Document recommended tidyverse alternatives to purrrlyr functions?

If I understand correctly, these are essentially functions that have been deprecated from tidyverse and have better alternatives?

because they have been replaced by other solutions in the tidyverse.

I think it would help folks migrate more easily to the preferred syntax if this package included a quick example of how the same thing is accomplished with tidyverse functions, or at least a quick pointer to the preferred patterns.

(e.g. I'm still trying to wrap my own head around the best way to iterate an arbitrary function through the rows of a data.frame, a la dplyr::rowwise+dplyr::do, purrrlyr::by_rows, tidyr::nest etc. I'm guessing nest is the preferred pattern these days)

collate="rows" strips factors to ints

For the by_* functions, any factor columns in a data frame returned by the function to be applied get converted to ints when collating by rows:

library(purrr)
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
library(purrrlyr)
library(magrittr)
#> 
#> Attaching package: 'magrittr'
#> The following object is masked from 'package:purrr':
#> 
#>     set_names

data_frame(a = factor(c("a", "b"))) %>% 
  by_row(~ .x, .collate="rows")
#> # tibble [2 x 3]
#>        a  .row     a
#>   <fctr> <int> <int>
#> 1      a     1     1
#> 2      b     2     2

data_frame(a = factor(c("a", "b"))) %>% 
  by_row(~ .x, .collate="list", .lables=FALSE) %>%
  pull(.out) %>%
  lift(bind_rows)()
#> # A tibble: 2 x 1
#>        a
#>   <fctr>
#> 1      a
#> 2      b

devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.4.1 (2017-06-30)
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  tz       US/Eastern                  
#>  date     2017-09-05
#> Packages -----------------------------------------------------------------
#>  package    * version date       source        
#>  assertthat   0.2.0   2017-04-11 CRAN (R 3.4.1)
#>  backports    1.1.0   2017-05-22 CRAN (R 3.4.1)
#>  base       * 3.4.1   2017-06-30 local         
#>  bindr        0.1     2016-11-13 CRAN (R 3.4.1)
#>  bindrcpp     0.2     2017-06-17 CRAN (R 3.4.1)
#>  compiler     3.4.1   2017-06-30 local         
#>  datasets   * 3.4.1   2017-06-30 local         
#>  devtools     1.13.3  2017-08-02 CRAN (R 3.4.1)
#>  digest       0.6.12  2017-01-27 CRAN (R 3.4.1)
#>  dplyr      * 0.7.2   2017-07-20 CRAN (R 3.4.1)
#>  evaluate     0.10.1  2017-06-24 CRAN (R 3.4.1)
#>  glue         1.1.1   2017-06-21 CRAN (R 3.4.1)
#>  graphics   * 3.4.1   2017-06-30 local         
#>  grDevices  * 3.4.1   2017-06-30 local         
#>  htmltools    0.3.6   2017-04-28 CRAN (R 3.4.1)
#>  knitr        1.17    2017-08-10 CRAN (R 3.4.1)
#>  magrittr   * 1.5     2014-11-22 CRAN (R 3.4.1)
#>  memoise      1.1.0   2017-04-21 CRAN (R 3.4.1)
#>  methods    * 3.4.1   2017-06-30 local         
#>  pkgconfig    2.0.1   2017-03-21 CRAN (R 3.4.1)
#>  purrr      * 0.2.3   2017-08-02 CRAN (R 3.4.1)
#>  purrrlyr   * 0.0.2   2017-05-13 CRAN (R 3.4.1)
#>  R6           2.2.2   2017-06-17 CRAN (R 3.4.1)
#>  Rcpp         0.12.12 2017-07-15 CRAN (R 3.4.1)
#>  rlang        0.1.2   2017-08-09 CRAN (R 3.4.1)
#>  rmarkdown    1.6     2017-06-15 CRAN (R 3.4.1)
#>  rprojroot    1.2     2017-01-16 CRAN (R 3.4.1)
#>  stats      * 3.4.1   2017-06-30 local         
#>  stringi      1.1.5   2017-04-07 CRAN (R 3.4.1)
#>  stringr      1.2.0   2017-02-18 CRAN (R 3.4.1)
#>  tibble       1.3.4   2017-08-22 CRAN (R 3.4.1)
#>  tools        3.4.1   2017-06-30 local         
#>  utils      * 3.4.1   2017-06-30 local         
#>  withr        2.0.0   2017-07-28 CRAN (R 3.4.1)
#>  yaml         2.1.14  2016-11-12 CRAN (R 3.4.1)

Errors installing from github

devtools::install_github("hadley/purrrlyr")
#> Using github PAT from envvar GITHUB_PAT
#> Downloading GitHub repo hadley/purrrlyr@master
#> 
#>      checking for file ‘/private/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T/RtmpAYygCz/remotes97bb3d3bc0b3/hadley-purrrlyr-70a5c08/DESCRIPTION’ ...  ✓  checking for file ‘/private/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T/RtmpAYygCz/remotes97bb3d3bc0b3/hadley-purrrlyr-70a5c08/DESCRIPTION’
#>   ─  preparing ‘purrrlyr’:
#>      checking DESCRIPTION meta-information ...  ✓  checking DESCRIPTION meta-information
#>   ─  cleaning src
#>   ─  checking for LF line-endings in source and make files and shell scripts
#>   ─  checking for empty or unneeded directories
#>   ─  building ‘purrrlyr_0.0.5.tar.gz’
#>      
#> 
#> Installing package into '/Users/u0982704/Library/R/3.6/library'
#> (as 'lib' is unspecified)
#> Error: Failed to install 'purrrlyr' from GitHub:
#>   (converted from warning) installation of package '/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T//RtmpAYygCz/file97bb5dfa56ee/purrrlyr_0.0.5.tar.gz' had non-zero exit status

standard output and standard error

* installing *source* package ‘purrrlyr’ ...
** using staged installation
** libs
/usr/local/Cellar/gcc/9.3.0/bin/g++-9 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/u0982704/Library/R/3.6/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c fast-copy.cpp -o fast-copy.o
/usr/local/Cellar/gcc/9.3.0/bin/gcc-9 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/u0982704/Library/R/3.6/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c init.c -o init.o
/usr/local/Cellar/gcc/9.3.0/bin/gcc-9 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/u0982704/Library/R/3.6/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c map.c -o map.o
/usr/local/Cellar/gcc/9.3.0/bin/g++-9 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/u0982704/Library/R/3.6/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c rows-data.cpp -o rows-data.o
/usr/local/Cellar/gcc/9.3.0/bin/g++-9 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/u0982704/Library/R/3.6/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c rows-formatter.cpp -o rows-formatter.o
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:655,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/stdlib/libstdcpp3.hpp:78,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config.hpp:49,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/lexical_cast.hpp:21,
                 from rows-formatter.cpp:2:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:17: error: 'uuid_t' was not declared in this scope; did you mean 'Rcpp::uuid_t'?
   39 | int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
      |                 ^~~~~~
      |                 Rcpp::uuid_t
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/uuid/uuid.h:39,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/execinfo.h:31,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/Rcpp/exceptions_impl.h:26,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/Rcpp.h:59,
                 from rows-formatter.cpp:1:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uuid_t.h:31:25: note: 'Rcpp::uuid_t' declared here
   31 | typedef __darwin_uuid_t uuid_t;
      |                         ^~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:655,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/stdlib/libstdcpp3.hpp:78,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config.hpp:49,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/lexical_cast.hpp:21,
                 from rows-formatter.cpp:2:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:25: error: expected primary-expression before 'const'
   39 | int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
      |                         ^~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:48: error: expression list treated as compound expression in initializer [-fpermissive]
   39 | int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
      |                                                ^
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config/stdlib/libstdcpp3.hpp:78,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/config.hpp:49,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/lexical_cast.hpp:21,
                 from rows-formatter.cpp:2:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:662:27: error: 'uuid_t' has not been declared
  662 | int  getsgroups_np(int *, uuid_t);
      |                           ^~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:664:27: error: 'uuid_t' has not been declared
  664 | int  getwgroups_np(int *, uuid_t);
      |                           ^~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:727:31: error: 'uuid_t' does not name a type; did you mean 'uid_t'?
  727 | int  setsgroups_np(int, const uuid_t);
      |                               ^~~~~~
      |                               uid_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:729:31: error: 'uuid_t' does not name a type; did you mean 'uid_t'?
  729 | int  setwgroups_np(int, const uuid_t);
      |                               ^~~~~~
      |                               uid_t
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/mpl/aux_/na_assert.hpp:23,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/mpl/arg.hpp:25,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/mpl/placeholders.hpp:24,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/iterator/iterator_categories.hpp:16,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/iterator/iterator_facade.hpp:13,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/range/iterator_range_core.hpp:27,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/lexical_cast.hpp:30,
                 from rows-formatter.cpp:2:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/mpl/assert.hpp:194:21: warning: unnecessary parentheses in declaration of 'assert_arg' [-Wparentheses]
  194 | failed ************ (Pred::************
      |                     ^
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/mpl/assert.hpp:199:21: warning: unnecessary parentheses in declaration of 'assert_not_arg' [-Wparentheses]
  199 | failed ************ (boost::mpl::not_<Pred>::************
      |                     ^
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/smart_ptr/shared_ptr.hpp:28,
                 from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/shared_ptr.hpp:17,
                 from rows-formatter.h:4,
                 from rows-formatter.cpp:6:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/smart_ptr/detail/shared_count.hpp:356:33: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
  356 |     explicit shared_count( std::auto_ptr<Y> & r ): pi_( new sp_counted_impl_p<Y>( r.get() ) )
      |                                 ^~~~~~~~
In file included from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/locale_conv.h:41,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/locale:43,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/iomanip:43,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/RcppCommon.h:52,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/Rcpp.h:27,
                 from rows-formatter.cpp:1:
/usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/unique_ptr.h:53:28: note: declared here
   53 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/shared_ptr.hpp:17,
                 from rows-formatter.h:4,
                 from rows-formatter.cpp:6:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/smart_ptr/shared_ptr.hpp:256:65: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
  256 | template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R >
      |                                                                 ^~~~~~~~
In file included from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/locale_conv.h:41,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/locale:43,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/iomanip:43,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/RcppCommon.h:52,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/Rcpp.h:27,
                 from rows-formatter.cpp:1:
/usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/unique_ptr.h:53:28: note: declared here
   53 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/shared_ptr.hpp:17,
                 from rows-formatter.h:4,
                 from rows-formatter.cpp:6:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/smart_ptr/shared_ptr.hpp:471:31: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
  471 |     explicit shared_ptr( std::auto_ptr<Y> & r ): px(r.get()), pn()
      |                               ^~~~~~~~
In file included from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/locale_conv.h:41,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/locale:43,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/iomanip:43,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/RcppCommon.h:52,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/Rcpp.h:27,
                 from rows-formatter.cpp:1:
/usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/unique_ptr.h:53:28: note: declared here
   53 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/shared_ptr.hpp:17,
                 from rows-formatter.h:4,
                 from rows-formatter.cpp:6:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/smart_ptr/shared_ptr.hpp:484:22: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
  484 |     shared_ptr( std::auto_ptr<Y> && r ): px(r.get()), pn()
      |                      ^~~~~~~~
In file included from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/locale_conv.h:41,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/locale:43,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/iomanip:43,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/RcppCommon.h:52,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/Rcpp.h:27,
                 from rows-formatter.cpp:1:
/usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/unique_ptr.h:53:28: note: declared here
   53 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/shared_ptr.hpp:17,
                 from rows-formatter.h:4,
                 from rows-formatter.cpp:6:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/smart_ptr/shared_ptr.hpp:567:34: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
  567 |     shared_ptr & operator=( std::auto_ptr<Y> & r )
      |                                  ^~~~~~~~
In file included from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/locale_conv.h:41,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/locale:43,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/iomanip:43,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/RcppCommon.h:52,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/Rcpp.h:27,
                 from rows-formatter.cpp:1:
/usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/unique_ptr.h:53:28: note: declared here
   53 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/shared_ptr.hpp:17,
                 from rows-formatter.h:4,
                 from rows-formatter.cpp:6:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/smart_ptr/shared_ptr.hpp:576:34: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
  576 |     shared_ptr & operator=( std::auto_ptr<Y> && r )
      |                                  ^~~~~~~~
In file included from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/locale_conv.h:41,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/locale:43,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/iomanip:43,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/RcppCommon.h:52,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/Rcpp.h:27,
                 from rows-formatter.cpp:1:
/usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/unique_ptr.h:53:28: note: declared here
   53 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/shared_ptr.hpp:17,
                 from rows-formatter.h:4,
                 from rows-formatter.cpp:6:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/smart_ptr/shared_ptr.hpp: In member function 'boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(std::auto_ptr<_Up>&&)':
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include/boost/smart_ptr/shared_ptr.hpp:578:38: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
  578 |         this_type( static_cast< std::auto_ptr<Y> && >( r ) ).swap( *this );
      |                                      ^~~~~~~~
In file included from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/locale_conv.h:41,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/locale:43,
                 from /usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/iomanip:43,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/RcppCommon.h:52,
                 from /Users/u0982704/Library/R/3.6/library/Rcpp/include/Rcpp.h:27,
                 from rows-formatter.cpp:1:
/usr/local/Cellar/gcc/9.3.0/include/c++/9.3.0/bits/unique_ptr.h:53:28: note: declared here
   53 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
make: *** [rows-formatter.o] Error 1
ERROR: compilation failed for package ‘purrrlyr’
* removing ‘/Users/u0982704/Library/R/3.6/library/purrrlyr’

Created on 2020-03-23 by the reprex package (v0.3.0)

STRING_PTR() can only be applied to a 'character', not a 'list'

Changes made to STRING_PTR() in R 3.5.0 has created bugs in purrrlyr function by_row()-
https://community.rstudio.com/t/string-ptr-can-only-be-applied-to-a-character-not-a-list/18100/9?u=indrajeetpatil

library(tidyverse)
library(purrrlyr)

# dataframe
dat <-
  structure(
    list(
      vars = c("var_1", "var_2"),
      data = list(
        structure(
          list(time = 1:10, value = c(1:10)),
          row.names = c(NA, -10L),
          class = c("tbl_df", "tbl", "data.frame")
        ),
        structure(
          list(time = 1:10, value = c(11:20)),
          row.names = c(NA, -10L),
          class = c("tbl_df", "tbl", "data.frame")
        )
      ),
      mu = c(1, 2),
      stdev = c(1, 2)
    ),
    class = c("tbl_df", "tbl", "data.frame"),
    row.names = c(NA, -2L)
  )

# applying operation row-wise
dat %>%
  purrrlyr::by_row(
    .d = .,
    ..f = ~dnorm(x = .$data[[1]]$value[[1]], mean = .$mu[[1]], sd = .$stdev[[1]]),
    collate = "rows"
  )
#> Error in purrrlyr::by_row(.d = ., ..f = ~dnorm(x = .$data[[1]]$value[[1]], : STRING_PTR() can only be applied to a 'character', not a 'list'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.