= R Tibble = '''Tibbles''' are a re-engineered [[R/DataFrames|data frame]]. They are available from the '''`tibble`''' package. <> ---- == Installation == The `tibble` package is commonly used through [[R/Tidyverse|Tidyverse]]. ---- == Usage == A tibble is instantiated like: {{{ > t1 <- tibble(foo = c(1,2,4), bar = c("a","b","c"), constant10 = 10) > t2 <- as_tibble(data.frame(foo = c(1,2,4), bar = c("a","b","c")) > t3 <- as_tibble(matrix(1:9, nrow=3)) > t4 <- as_tibble(matrix(1:9, nrow=3), .name_repair="universal") > t5 <- as_tibble(matrix(1:9, nrow=3), rownames="casenum", .name_repair="universal") }}} In comparison to [[R/DataFrames|data frames]]: * Input column vectors ''must'' either be the same length, or be a scalar value. Only scalars are recycled. * `t3` here has column names like V1 and so on. But a warning is issued; see `t4` for the officially supported method. * Tibbles do not store row names. This is mostly relevant when casting a matrix, as data frames usually use an ID column for row names. `t5` here shows how to retain the row names as a new column. Note that tibbles store each column separately, and that tibbles instantiate the columns sequentially. It is possible to declare a column as a function of prior columns. Tibbles are [[R/DataTypes#Classes|multiclassed]] as both `data.frame` and `tbl_df`. ---- CategoryRicottone