Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

#RStudio How to use variable in xls file as input parameter

I usually declare some variables for next process input, but i want to move all variables into a separate xlsx file but still confused on how to call the variables

start_dt <- 20211001
end_dt <- 20211031

I’m expecting the variables are split just like above code so i can use each of them separately, but now they are in single vector

param_date <- read_excel("D:/Model/parameter.xlsx",sheet="date") %>% 
  as_vector()

xlsx input

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

rstudio variables

Thanks

>Solution :

Based on your screenshots, the following should work to extract them:

param_date <- read_excel("D:/Model/parameter.xlsx",sheet="date") %>% 
  as_vector()
start_dt <- param_date[3]
end_dt <- param_date[4]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading