[R] [External] openxlsx::read.xlsx can't read data without a header
Richard M. Heiberger
rmh @end|ng |rom temp|e@edu
Fri Oct 23 06:18:19 CEST 2020
?openxlsx::read.xlsx
The fourth argument by default is TRUE
colNames: If ‘TRUE’, the first row of data will be used as column
names.
You will need to specify it explicitly
as colNames=FALSE
The other arguments will probably also be useful to you.
On Thu, Oct 22, 2020 at 11:56 PM John <miaojpm using gmail.com> wrote:
>
> Hi,
>
> I try to read 6 rows (from 5th to 10th) from Excel, but I can always get
> 5. The first row of the 6 becomes the header. How can I add something like
> "header = FALSE" in the formula, so that the resulting data would be all
> the 6 rows? A similar problem occurs in readxl::read_xlsx. Thank you!
>
> > temp <- openxlsx::read.xlsx(fl_trilem_sgko, sheet="Korea", rows=5:10,
> cols=25, skipEmptyRows = FALSE, na.strings = "NA")
> > temp
> 0.12101775061124695
> 1 0.09613981
> 2 0.16259886
> 3 0.07914472
> 4 0.10195485
> 5 0.07700853
> > nrow(temp)
> [1] 5
>
>
> John
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list