load an excel file starting at row 5 in r

To load an Excel file starting from row 5 in R, we can use the read_excel() function from the readxl package. We can specify the starting row using the range parameter.

Here's an example code snippet:

main.r
library(readxl)

# set the path of the Excel file
excel_file <- "path/to/excel/file.xlsx"

# load the file starting from row 5
df <- read_excel(excel_file, sheet = 1, range = "A5:XFD", col_names = TRUE)
203 chars
8 lines

In the above code, we specify the sheet number as 1 and the range parameter as "A5:XFD". This will load the Excel file starting from row 5 and all columns up to the last column available in the Excel file (column XFD).

Note that we set col_names to TRUE to include column names in the resulting data frame. If the Excel file does not have column names, set col_names to FALSE and R will generate default column names.

gistlibby LogSnag