asthistibble: Copy tibble attributes

View source: R/asthistibble.R

asthistibbleR Documentation

Copy tibble attributes

Description

Converts a data frame into a tibble copying all attributes.

Usage

asthistibble(tibble, x)

Arguments

tibble

a tibble object.

x

a data frame with the same columns of tibble.

Value

A tibble.

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]
tib

asthistibble(tibble = tib, x = x)


ILSAmerge documentation built on April 11, 2025, 5:54 p.m.