To read ". ods" files just use the function read_ods
package readODS
.
In the example below I create an ODS file with the data from data frame. mtcars
and then I read it.
tf <- tempfile(fileext = ".ods")
readODS::write_ods(mtcars, tf)
mtcars2 <- readODS::read_ods(tf)
#> Parsed with column specification:
#> cols(
#> mpg = col_double(),
#> cyl = col_double(),
#> disp = col_double(),
#> hp = col_double(),
#> drat = col_double(),
#> wt = col_double(),
#> qsec = col_double(),
#> vs = col_double(),
#> am = col_double(),
#> gear = col_double(),
#> carb = col_double()
#> )
Note that the information read is identical to the information saved.
head(mtcars2)
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> 1 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
#> 2 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
#> 3 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
#> 4 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
#> 5 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
#> 6 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
Created on 2019-05-03 by the reprex package (v0.2.1)
It is worth noting that the argument col_names = TRUE
is the standard argument and therefore does not need to be provided.
attach in question the file "test.ods"
– Guilherme Parreira