Transform an R object (mostly matrix or data.frame) into a cell_df for further processing in other tidycells functions.

as_cell_df(d, take_row_names = FALSE, take_col_names = FALSE)

Arguments

d

the data (either a matrix with column name or a data.frame)

take_row_names

consider row names as separate cells (applicable only for data with no (row, col) information). Default is FALSE.

take_col_names

consider column names as separate cells (applicable only for data with no (row, col) information). Default is FALSE.

Value

An object of class cell_df.

Note: After this, you may like to do Value Attribute Classification.

See also

Examples

as_cell_df(iris)
#> A Cell Data Frame #> = To see cell stats, call summary() #> = To see cell structure, call plot() #> = Content: #> #> +-----------------------------------+ #> | | #> | row col data_type value | #> | 1 1 1 numeric 5.1 | #> | 2 2 1 numeric 4.9 | #> | 3 3 1 numeric 4.7 | #> | 4 4 1 numeric 4.6 | #> | # ... with 746 more rows | #> | | #> +-----------------------------------+
# consider column name as cell as_cell_df(iris, take_col_names = TRUE)
#> A Cell Data Frame #> = To see cell stats, call summary() #> = To see cell structure, call plot() #> = Content: #> #> +------------------------------------------+ #> | | #> | row col data_type value | #> | 1 1 1 character Sepal.Length | #> | 2 2 1 numeric 5.1 | #> | 3 3 1 numeric 4.9 | #> | 4 4 1 numeric 4.7 | #> | # ... with 751 more rows | #> | | #> +------------------------------------------+
# if the data is already in a similar format it will not further transform # which is not true for ---> unpivotr::as_cells # check ---> unpivotr::as_cells(iris) %>% unpivotr::as_cells() unpivotr::as_cells(iris) %>% as_cell_df()
#> A Cell Data Frame #> = To see cell stats, call summary() #> = To see cell structure, call plot() #> = Content: #> #> +-----------------------------------+ #> | | #> | row col data_type value | #> | 1 1 1 numeric 5.1 | #> | 2 2 1 numeric 4.9 | #> | 3 3 1 numeric 4.7 | #> | 4 4 1 numeric 4.6 | #> | # ... with 746 more rows | #> | | #> +-----------------------------------+