Skip to content

Instantly share code, notes, and snippets.

View Christoph999's full-sized avatar

Christoph Strauss Christoph999

  • FH St. Gallen
  • Swizerland
View GitHub Profile
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
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!
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), ]
# 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)
}