I have two data tables, and let me suppose them "a" and "infectedvehicle_by_link" respectively.
I used "left_join" function to join them by key value "link_id".
Since it didn't work, I checked their types and the result was as following :
Thus, the types of key value that I want to use to match two tables were different. So I coded like followings :
for(i in 1:9) {
a = fread(paste0("exposure_", i, i, ".csv"))
as.character(a)
b = left_join(a, infectedvehicle_by_link, by = ("link_id"))}
The code returned this error - Error in UseMethod("left_join") : no applicable method for 'left_join' applied to an object of class "character"
So I tried second method...
for(i in 1:9) {
a = fread(paste0("exposure_", i, i, ".csv"))
as.integer(infectedvehicle_by_link)
b = left_join(a, infectedvehicle_by_link, by = ("link_id"))}
But this returned this error - Error in as.integer(infectedvehicle_by_link) : 'list' object cannot be coerced to type 'integer'
In this situation, what the hell should I do to join two tables?