0

I'm trying to subset some variables from my dataset, but I encounter an error.

library(readxl)

Vitamin_D_MRS <- read_excel("~/Documents/OneDrive - Imperial College London/6. Micronutrients project/R_Directory_Demographics/Vitamin D MRS.xlsx", 
                                sheet = "MRS")
    
data <- subset(Vitamin_D_MRS, select = c(PCR_status, Sex, Age,
               BMI, ethnic, comorb, Vitamin_supplementation, Season, Exposure))
#Error message:
    Error in `vec_as_location()`:
    ! `...` must be empty.
    ✖ Problematic argument:
    • call = call
Andrea M
  • 2,314
  • 1
  • 9
  • 27
  • try `library(dplyr) data = Vitamin_D_MRS %>% select(PCR_status, Sex, Age, BMI, ethnic, comorb, Vitamin_supplementation, Season, Exposure)` – Julian Aug 10 '22 at 14:47
  • I can't reproduce the error with a dataframe that contains those variables, so it might be an issue with your `Vitamin_D_MRS`. Can you edit your question to add a minimal, reproducible example? [How to make a great R reproducible example](https://stackoverflow.com/a/5963610/13968222) – Andrea M Aug 11 '22 at 08:21

0 Answers0