I am quite new to R but it seems, this question is closely related to the following post 1, 2, 3 and a bit different topic 4. Unfortunately, I have not enough reputation to comment right there. My problem is that after going through all the suggestions there, the code still does not work:
- I included "Depends" in the description file
I tried the second method including a change of NAMESPACE(Not reproducable)- I created a example package here containing a very small part of the code which showed a bit different error (
"J" not found in routes[J(lat1, lng1, lat2, lng2), .I, roll = "nearest", by = .EACHI]
instead of'lat1' not found in routes[order(lat1, lng1, lat2, lng2, time)]
) - I tested all scripts using the console and R-scripts. There, the code ran without problems.
Thank you very much for your support!
Edit: @Roland
- You are right. Roxygen overwrites the namespace. You have to include
#' @import data.table
to the function. Do you understand, why only insertingDepends: data.table
in the DESCRIPTION file does not work? This might be a useful hint in the documentation or did I miss it? - It was missleading that changing to routes <- routes[order("lat1", "lng1", "lat2", "lng2", "time")] helped at least a bit as this line was suddenly no problem any more. Is it correct, that in this case data.frame order is used? I will see how far I get now. I will let you know the final result...