This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(data.table) | |
# Minimum and Maximum number of rows: | |
nmin <- 1e2 | |
nmax <- 1e4 # Be careful with values >1e6. It takes several minutes then... | |
# Old search without data.table | |
find_routes <- function(routes, lat1, lng1, lat2, lng2, prec = 4L){ | |
x1 <- lat1 | |
y1 <- lng1 | |
x2 <- lat2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imsbasics::clc() | |
mysum <- function(dt, x1, y1) { | |
res <- x1+y1 | |
return(res) | |
} | |
myfun <- function(dt, x1, y1) { | |
# Hadley Advanced R p. 74: If a name isn't defined inside a function R will | |
# look one level up and so on But here they are defined! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(lubridate) # Include to avoid lubridate:: all the time | |
imsbasics::clc() | |
path <- paste0(getwd(), "/data/RData/SG/2014/") | |
t0_date = lubridate::ymd_hms("2014-01-01 00:00:00") | |
# ============================================================================== | |
# Files to load: | |
hist_scenario <- imsbasics::load_rdata("hist_scenario", path) | |
hist_scenario$missions <- hist_scenario$missions[!is.na(hist_scenario$missions$lat), ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Error on purpose in line 31-36. Testscript for learning debugging using different options. | |
imsbasics::clc() | |
f1 <- function(a) { | |
# message("Message f1") | |
b <- 10 | |
return(a + 1) | |
} | |