Converts a data frame into a tibble copying all attributes.
Examples
# tibble generated by haven
input <- system.file("extdata/reds", package = "ILSAmerge")
tib <- do.call(rbind,justload(inputdir = input,population = "BCGV1"))
# Remove all tibble attributes
x <- tib
class(x) <- "data.frame"
for(i in 1:ncol(x)){
attributes(x[,1]) <- NULL
}
# Mix variables
set.seed(1919)
x <- x[,sample(ncol(x))]
head(x)[,1:10]
#> CRWGT30 IP1G02D IP1G04C IP1G09C IP1G16I CRWGT1 IP1G22A CRWGT11 IP1G26H
#> 1 1.000000 2 2 1 1 2.000000 1 1.000000 2
#> 2 1.081018 2 1 1 1 0.000000 1 1.081018 1
#> 3 1.228068 1 1 2 1 1.228068 1 1.228068 1
#> 4 1.251065 2 1 1 2 1.251065 1 1.251065 1
#> 5 1.352366 3 3 1 2 1.352366 1 1.352366 1
#> 6 1.575634 2 1 1 1 1.575634 1 1.575634 1
#> IP1G32A
#> 1 0
#> 2 330
#> 3 9999
#> 4 0
#> 5 201
#> 6 224
tib
#> # A tibble: 40 × 314
#> IDCNTRY IDSCHOOL ITLANGC IP1G00A IP1G00B IP1G00C
#> <dbl+lbl> <dbl+lb> <dbl+lbl> <dbl+lbl> <dbl+lbl> <dbl+lbl>
#> 1 784 [United Arab E… 1001 53 [Arabic] 2 [Mid] 3 [March] 9 (NA) [Omi…
#> 2 784 [United Arab E… 1002 53 [Arabic] 1 [Early] 2 [February] 3 [Late]
#> 3 784 [United Arab E… 1003 53 [Arabic] 1 [Early] 2 [February] 3 [Late]
#> 4 784 [United Arab E… 1004 1 [English] 3 [Late] 2 [February] 3 [Late]
#> 5 784 [United Arab E… 1005 53 [Arabic] 1 [Early] 3 [March] 3 [Late]
#> 6 784 [United Arab E… 1006 53 [Arabic] 2 [Mid] 2 [February] 2 [Mid]
#> 7 784 [United Arab E… 1007 53 [Arabic] 1 [Early] 3 [March] 3 [Late]
#> 8 784 [United Arab E… 1008 53 [Arabic] 1 [Early] 3 [March] 2 [Mid]
#> 9 784 [United Arab E… 1009 53 [Arabic] 2 [Mid] 3 [March] 1 [Early]
#> 10 784 [United Arab E… 1010 53 [Arabic] 2 [Mid] 6 [June] 3 [Late]
#> # ℹ 30 more rows
#> # ℹ 308 more variables: IP1G00D <dbl+lbl>, IP1GIAA <dbl+lbl>,
#> # IP1GIAB <dbl+lbl>, IP1GIAC <dbl+lbl>, IP1GIAD <dbl+lbl>, IP1GIAE <dbl+lbl>,
#> # IP1GIAF <dbl+lbl>, IP1GIAG <dbl+lbl>, IP1GIBA <dbl+lbl>, IP1GIBB <dbl+lbl>,
#> # IP1GIBC <dbl+lbl>, IP1GIBD <dbl+lbl>, IP1G01A <dbl+lbl>, IP1G01B <dbl+lbl>,
#> # IP1G01C1 <dbl+lbl>, IP1G01C2 <dbl+lbl>, IP2G01A1 <dbl+lbl>,
#> # IP1G01AA <dbl+lbl>, IP1G02A <dbl+lbl>, IP1G02B <dbl+lbl>, …
asthistibble(tibble = tib, x = x)
#> # A tibble: 40 × 314
#> IDCNTRY IDSCHOOL ITLANGC IP1G00A IP1G00B IP1G00C
#> <dbl+lbl> <dbl+lb> <dbl+lbl> <dbl+lbl> <dbl+lbl> <dbl+lbl>
#> 1 784 [United Arab E… 1001 53 [Arabic] 2 [Mid] 3 [March] 9 (NA) [Omi…
#> 2 784 [United Arab E… 1002 53 [Arabic] 1 [Early] 2 [February] 3 [Late]
#> 3 784 [United Arab E… 1003 53 [Arabic] 1 [Early] 2 [February] 3 [Late]
#> 4 784 [United Arab E… 1004 1 [English] 3 [Late] 2 [February] 3 [Late]
#> 5 784 [United Arab E… 1005 53 [Arabic] 1 [Early] 3 [March] 3 [Late]
#> 6 784 [United Arab E… 1006 53 [Arabic] 2 [Mid] 2 [February] 2 [Mid]
#> 7 784 [United Arab E… 1007 53 [Arabic] 1 [Early] 3 [March] 3 [Late]
#> 8 784 [United Arab E… 1008 53 [Arabic] 1 [Early] 3 [March] 2 [Mid]
#> 9 784 [United Arab E… 1009 53 [Arabic] 2 [Mid] 3 [March] 1 [Early]
#> 10 784 [United Arab E… 1010 53 [Arabic] 2 [Mid] 6 [June] 3 [Late]
#> # ℹ 30 more rows
#> # ℹ 308 more variables: IP1G00D <dbl+lbl>, IP1GIAA <dbl+lbl>,
#> # IP1GIAB <dbl+lbl>, IP1GIAC <dbl+lbl>, IP1GIAD <dbl+lbl>, IP1GIAE <dbl+lbl>,
#> # IP1GIAF <dbl+lbl>, IP1GIAG <dbl+lbl>, IP1GIBA <dbl+lbl>, IP1GIBB <dbl+lbl>,
#> # IP1GIBC <dbl+lbl>, IP1GIBD <dbl+lbl>, IP1G01A <dbl+lbl>, IP1G01B <dbl+lbl>,
#> # IP1G01C1 <dbl+lbl>, IP1G01C2 <dbl+lbl>, IP2G01A1 <dbl+lbl>,
#> # IP1G01AA <dbl+lbl>, IP1G02A <dbl+lbl>, IP1G02B <dbl+lbl>, …