l <- list(x = rnorm(2), y = 1:2);
paristools:::as_tibble(l)
#> # A tibble: 2 × 2
#> x y
#> <dbl> <int>
#> 1 0.0803 1
#> 2 0.0119 2
tibble::as_tibble(l)
#> # A tibble: 2 × 2
#> x y
#> <dbl> <int>
#> 1 0.0803 1
#> 2 0.0119 2
paristools:::as_tibble(l)
#> # A tibble: 2 × 2
#> x y
#> <dbl> <int>
#> 1 0.0803 1
#> 2 0.0119 2
as_tibble()
converts a non-empty
List
of equal-length elements into a tibble.
# include <Rcpp.h>
// [[Rcpp::depends(paristools)]]
# include <paristools.h>
using namespace Rcpp;
//[[Rcpp::export]]
() {
List demo_as_tibble// construct a list
= IntegerVector::create(1, 2, 3);
IntegerVector a = CharacterVector::create("a", "b", "c");
CharacterVector b = List::create(Named("a") = a, Named("b") = b);
List l
return paristools::as_tibble(l);
}
demo_as_tibble()
#> # A tibble: 3 × 2
#> a b
#> <int> <chr>
#> 1 1 a
#> 2 2 b
#> 3 3 c