Skip to contents

simple_rectify converts a set of cells extracted by read_ods_cells() into a traditional rectangular two-dimensional structure.

Usage

simple_rectify(ods_cells, base_values = TRUE)

Arguments

ods_cells

A set of cells from an ODS sheet

base_values

Whether to use the base_value of a cell (TRUE, the default) or whether to provide the cell content as seen by a spreadsheet user.

Value

A tibble representing the original spreadsheet format.

Details

When set to TRUE (the default) the base_values argument then the underlying cell values are used. When FALSE then cell content as seen by a spreadsheet application user will be shown. See read_ods_cells() for further details.

Column headers are of the format "X#", i.e. "X" and the column number. You can use another function such as janitor::row_to_names() to replace these with values from a row within the dataset.

Examples

example <- system.file("extdata", "basic_example.ods", package = "tidyods")
example_cells <- read_ods_cells(example, 1)
#> Unzipping ODS file
#> Reading XML file
simple_rectify(example_cells, base_values = TRUE)
#> # A tibble: 7 × 4
#>   X1        X2     X3               X4              
#>   <chr>     <chr>  <chr>            <chr>           
#> 1 species   female bill_length_mm   body_mass_g     
#> 2 Adelie    false  40.3904109589041 4043.49315068493
#> 3 Adelie    true   37.2575342465753 3368.83561643836
#> 4 Chinstrap false  51.0941176470588 3938.97058823529
#> 5 Chinstrap true   46.5735294117647 3527.20588235294
#> 6 Gentoo    false  49.4737704918033 5484.83606557377
#> 7 Gentoo    true   45.5637931034483 4679.74137931035