Reading one sheet from excel in rstudio
Asked Answered
B

2

6

I have an excel file with two sheets, A & B. I need to upload and use the data in Rstudio from sheet B ONLY. How can I do that?

I imported the file to the rstudio and I wrote this : dat <- read_excel ("multi_anova.xlsx")

but when I try to use the data, such as (dat$id) , it gives me all the excels's file id's, not only the B sheet.

How can I get the B sheet's ids ?

Bartels answered 24/5, 2021 at 10:37 Comment(0)
B
7

Specify the sheet name from where you want to read the data in read_excel function -

dat <- read_excel("multi_anova.xlsx", sheet = "B")
dat$id
Batting answered 24/5, 2021 at 10:40 Comment(0)
H
1

We can use read.xlsx from openxlsx

library(openxlsx)
dat <- read.xlsx("multi_anova.xlsx", sheet = "B")
dat$id
Hypotonic answered 24/5, 2021 at 18:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.