advanced patterns with data.table when using setkey on character columns in R
I've hit a wall trying to I'm not sure how to approach I'm trying to configure I've been working on this all day and I'm working with an scenario with the `data.table` package in R, specifically when using the `setkey` function on a data frame with character columns... I have a data frame that contains a column of identifiers stored as character strings, and I want to perform joins on these identifiers efficiently using `data.table`. However, after setting the key, the join does not return the expected results. Here's a minimal example that illustrates my question: ```r library(data.table) # Create a sample data.table DT <- data.table(id = c('A', 'B', 'C'), value = c(1, 2, 3)) # Set the key on the id column setkey(DT, id) # Create another data.table to join with DT2 <- data.table(id = c('A', 'B', 'D'), value2 = c(10, 20, 30)) # Trying to perform a join result <- DT[DT2, on = .(id)] print(result) ``` What I expect is to get rows for 'A' and 'B' from `DT`, with `NA` for 'D' since it doesn't exist in `DT`. However, the resulting data.table shows only the values from `DT` and no NA values for the missing keys: ```r id value 1: A 1 2: B 2 ``` This is unexpected because I assumed `data.table` would handle missing keys similarly to how it does with numeric keys. I've tried checking the structure of both data.tables, and they seem fine. The types align correctly, yet I don't get the expected behavior. I'm using R version 4.2.1 and `data.table` version 1.14.0. Is there something I'm overlooking or a specific configuration I should be aware of when using `setkey` with character columns? Any help would be appreciated! Any suggestions would be helpful. Any ideas how to fix this? This is happening in both development and production on Ubuntu 22.04. I'd really appreciate any guidance on this. My development environment is Windows 10.