Search code examples
rheaderrow

First row won´t delete in r


I'm having an issue with deleting the first cell in R. I have tried many ways but none work.

file0 <- read_excel("path")

I have tried file1 <- file0[,-1] and file1 <- file0[-1,-1] but the result don't catch me the line. Data is from a downloadable excel which I pull to R. This is how it looks:

Applied filters:
Activity Count State
xx 2 Pending
xx 2 Pending

Applying file1 <- file0[-c(1),] deletes the blank row but not the "applied filters". I want The "Actity" row to be the header and delete both the blank row and "applied filters" row. Any suggestion?


Solution

  • You can use this:

    file0 <- read_excel("path", skip = 1)

    Or (since I am not completely sure about the structure of your data):

    file0 <- read_excel("path", skip = 2)