Advertisement
mwhuhn

Untitled

Nov 13th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.39 KB | None | 0 0
  1. library(tidyverse)
  2.  
  3. dfa <- data.frame(a = sample(1:100,10, replace=T),
  4.                   b = sample(0:1,10, replace=T))
  5. dfb <- data.frame(a = sample(1:100,10, replace=T),
  6.                   b = sample(0:1,10, replace=T))
  7.  
  8. x <- list("dfa"=dfa, "dfb"=dfb)
  9.  
  10. convert <- function(x) {
  11.   walk2(as.list(names(x)), map(x, as_tibble), function(a, b) assign(a, b, envir = .GlobalEnv))
  12. }
  13.  
  14. convert(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement