Reputation: 117
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 ?
Upvotes: 7
Views: 13053
Reputation: 887961
We can use read.xlsx
from openxlsx
library(openxlsx)
dat <- read.xlsx("multi_anova.xlsx", sheet = "B")
dat$id
Upvotes: 1
Reputation: 389325
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
Upvotes: 10