When I run this code
url <- "https://github.com/midas-network/covid19-scenario-modeling-hub/blob/master/data-processed/Karlen-pypm/2021-05-30-Karlen-pypm.zip?raw=true"
temp <- tempfile()
download.file(url, temp)
karlen_model <- read.csv(unz(temp, "2021-05-30-Karlen-pypm.csv"))
unlink(temp)
#karlen_model <- fread("/Karlen-pypm/2021-05-30-Karlen-pypm.csv")
karlen_ca <- karlen_model[location %in% "06"]
I get the error:
"Error in match(x, table, nomatch = 0L) :
'match' requires vector arguments"
I tried this workaround:
karlen_ca <- karlen_model[location == "06"]
but get another error:
Error in location == "06" :
comparison (1) is possible only for atomic and list types
Please note that:
- Since I'm downloading publicly available data, the example is reproducible;
- The object
karlen_model
is a data frame; and class(karlen_model$location)
returnsfactor
.
Many thanks, David