I am getting NA values for only some rows in my first table (doses) when I am using dplyr::left_join, but these rows have correspondent values in my second table (grid). I wrote a small example below:
set.seed(1234)
x_s <- c(1.0, 0.6, 0.2)
y_s <- c(0, 0.5, 1.0)
doses <- data.frame(x = x_s, y = y_s)
doses
y <- seq(0, 1, length = 3)
x <- seq(0, 1, length = 6)
prob <- runif(length(x))
grid <- expand.grid(x = x, y = y)
grid$prob = prob
grid
left_join(doses, grid, by = c("x", "y"))
What am I doing wrong?