andybega/icews

update_icews fails with first file

mayeulk opened this issue · 5 comments

After a fresh install on Ubuntu 18.04, the following fails with an error:

library("icews")
library("DBI")
library("dplyr")
library("usethis")
# Note: do not end the data_dir with a slash
setup_icews(data_dir = "/home/mk/Documents/data/icews", use_db = TRUE, keep_files = TRUE,  r_profile = TRUE)

update_icews(dryrun = TRUE)
update_icews(dryrun = FALSE)

Message I got after the last line of code is:

Downloading '20181004-icews-events.zip'
Ingesting records from '20181004-icews-events.tab'
Error in if (min(events$event_date) <= max_date_in_db) { : 
    valor ausente donde TRUE/FALSE es necesario

(last line is more ore less "missing value where TRUE/FALSE is necessary")

With keep_files = FALSE instead (after restarting R), this is the error

Ingesting records from '20181004-icews-events.tab'
Error in get_fileid.character(dataset, file, key = key, server = server,  : 
                                File not found

Same behaviour after updating all Ubuntu packages and running update.packages() in R.
R version 3.6.0 (2019-04-26)

> dr_icews()
Checking ICEWS options...options are set
Backend: database and files
data_dir: /home/mk/Documents/data/icews
use_db: TRUE
keep_files: TRUE
Check local file status...
Looking for data at: '/home/mk/Documents/data/icews/raw'
Found 1 local data file(s)
Check database status...
Looking for database at: '/home/mk/Documents/data/icews/db/icews.sqlite3'
Found 0 events in database

Hey, thank you for noting this issue. I just got back from traveling, will try to look into this soon.

When you manually do this query, what do you get?

library("icews")
query_icews("select max(event_date) from events;")

I'm guessing it was NA due to first time setup and that was causing the problem.

In effect. Before (and after) updating icews package (with your new commit), I have:

> query_icews("select max(event_date) from events;")
  max(event_date)
1              NA

After updating icews package (with your new commit), the import works correctly, that's great! Thanks a lot!

Great, thanks for letting me know about the issue (and the other one you opened)!