0
I’m trying to import some data into R, but no matter what I do, there’s always a row with column names (row information I want to skip). This is the table:
However, in R, even skipping the first line, this information comes along.
Follows code for reproducibility of the problem:
library(tidyverse)
dados <- tribble(
~Regiao, ~`Obitos fetais`, ~X1, ~X2, ~X3, ~X4, ~Obitos, ~X5, ~X6, ~X7, ~X8,
NA, 2005, 2006, 2007, 2008, 2009, 2005, 2006, 2007, 2008, 2009,
"Norte", 2106, 2159, 2038, 2119, 2099, 52815, 52286, 53538, 5507, 57375,
"Nordeste", 6896, 6776, 6479, 6941, 6947, 242303, 248049, 258049, 263198, 267177,
"sudeste", 12356, 11749, 11213, 10962, 10632, 478126, 493358, 493478, 501578, 511492,
"Sul", 3605, 3462, 3251, 3221, 3024, 159760, 163914, 169124, 169337, 174871,
"Centro-Oeste", 1856, 1922, 1781, 1725, 1710, 60573, 62585, 64353, 66641, 68301
)
library(openxlsx)
write.xlsx(dados, "meusdados.xlsx", sheetName = "tipo4")
tipo4 <- xlsx::read.xlsx("meusdados.xlsx", "tipo4", starRow = 2, endRow = 7)
seems to me a typo: the argument name is
startRow
and you usedstarRow
.– Daniel Falbel
@Maniero I would only change the reason for closing p/ "This problem cannot be reproduced, or is a typo. Even within the scope of the site, your solution would hardly be useful to other users in the future. Problems like this can be avoided by creating a Minimum, Complete and Verifiable example."
– Daniel Falbel
@Danielfalbel done!
– Maniero
Thank you very much!
– Fabiano Meira