Hi R community,
I have 2 data tables in R (DT_Paths and DT_Nodes):
DT_Paths is a table with a source and a destination, and a count which returns the amount of exchanges between source and destination:
sapply(DT_Paths, mode) Source Destination Count "character" "character" "numeric"
DT_Nodes is a table with all unique sources and destinations (column name 'studieprogramma'), and a numerical lookup value (in column 'lookup'):
sapply(DT_Nodes, mode) Studieprogramma lookup Index "character" "numeric" "numeric"
In table DT_Paths I would like to add the numerical equivalent of each source and destination by using the lookup function:
DT_Paths$SourceNum <- lookup(DT_Paths$Source, DT_Nodes)
The new column SourceNum, however, only returns NA, indicating there is no match between the 2 tables. Visually (and also in Excel), the values in the 2 tables give a match but apparently the current R code is unable to see this match. At least that's what I think the problem is.
Does anyone have an idea how I could change the lookup function or the data type of the tables to get the match? Do I need to use another function? ...
Thanks in advance