Hi,

I am trying to read specific rows and columns from a xlsx file using the
following commands:

# Read rows 18-23 and columns 7-15 into R and assign the result to a
variable
# called dat

colIndex <- 18:23
rowIndex <- 7:15
dat <- read.xlsx("./data/natural_gas.xlsx", sheetIndex = 1, header = TRUE,
                 colIndex = colIndex, rowIndex = rowIndex)

But I get this error:

Error in strsplit(names(res), "\\.") : non-character argument


I don't understand where that non-character comes from.
When I read the whole file with:

naturalGas <- read.xlsx("./data/natural_gas.xlsx", sheetIndex = 1, header =
TRUE)

I don't get any problem.

Should you be willing to try to reproduce this behavior, the file comes
from:
https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2FDATA.gov_NGAP.xlsx

sessionInfo()R version 3.1.1 (2014-07-10)
Platform: x86_64-pc-linux-gnu (64-bit)


I'm on debian Jessie.

Disclaimer: this is a homework.

Thank you in advance


-- 
Best regards,

Dr. Margherita DI LEO
Scientific / technical project officer

European Commission - DG JRC
Institute for Environment and Sustainability (IES)
Via Fermi, 2749
I-21027 Ispra (VA) - Italy - TP 261

Tel. +39 0332 78 3600
margherita.di-...@jrc.ec.europa.eu

Disclaimer: The views expressed are purely those of the writer and may not
in any circumstance be regarded as stating an official position of the
European Commission.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to