I know it is possible to read only certain columns with the package XLConnect. But is it also possible to only read certain rows?
demoExcelFile <- system.file("demoFiles/mtcars.xlsx", package = "XLConnect")
wb <- loadWorkbook(demoExcelFile)
# Read the columns 1, 3 and 5 from the sheet 'mtcars' (with default header = TRUE)
data <- readWorksheet(wb, sheet = "mtcars", keep=c(1,3,5))
read all rows using readWorksheet and then select certain rows from data.frame you've got
for example:
data <- readWorksheet(wb, sheet = "mtcars")
new.data <- data[c(10, 20, 30), ]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.