0

I want to import only a couple of rows of a large Excel sheet in R (repeatedly, from different sheets, with different rows).
Once imported the whole sheet would look something like:

data.frame(cat=rep(1:10,each=2),val=rnorm(20,10,1))
I could of course import and then subset

`mydata <- read_excel("file")[var1=="expr",]`  

but then I would unnecessarily import the whole sheet. Is there any possibility to filter the sheet before importing it?

Julia
  • 26
  • 2
  • 1
    You can use the `range` argument of `read_excel` to select the cells you want to import, or a combination of `skip` and `nmax` to select rows – Esther Jun 08 '18 at 08:31
  • There is a way you are able to work with csv files instead of excel, see https://stackoverflow.com/questions/15967226/skip-some-rows-in-read-csv-in-r – Stelios K. Jun 08 '18 at 08:39

0 Answers0