Hi,
I'm new to R and I have a question about matching a variable taken from an Excel file with an SQL database.
My starting point is preparing a file:
library(RODBC)
abc <- odbcConnect("sqldatabase")
my.data <- sqlQuery(abc, "SELECT * FROM sqldatatable")
my.local.data <- collect(my.data)
Belgium.data <- my.data[my.data$CountryID == 15, ]
Belgium.CurrentHY.data <- subset(Belgium.data, InterviewDate > "2018-04-01" & InterviewDate < "2018-09-30")
I can display it without any problems:
str(Belgium.CurrentHY.data)
$ CountryID : int 15 15 15 15 15 15 15 15 15 15 ... $ InterviewDate : POSIXct, format: "2018-04-25 08:12:00" "2018-04-26 13:05:00" "2018-04-04 17:28:00" "2018-04-10 12:12:00" ...
$ URN : Factor w/ 192210 levels "615000515307",..: 138831 138834 138838 138839 138855 138870 138875 138877 138886 138887 ...$ A2 : int 9 10 10 8 10 9 10 10 9 10 ...
$ B1 : int 10 10 8 7 10 8 9 10 8 10 ...
$ C1 : int 10 10 9 8 10 9 10 9 9 9 ...
so Belgium.CurrentHY.data exists
Now, I would like to use only selected records (URNs) from Belgium.CurrentHY.data and they are saved in a seperate Excel file P:\xxx\yyy\URNs in Run\List of URNs.xlsx
How can I do that?