This file contains 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
pkgTest <- function(x) | |
{ | |
if (!require(x,character.only = TRUE)) | |
{ | |
install.packages(x,dep=TRUE, repos="http://cran-mirror.cs.uu.nl/") | |
if(!require(x,character.only = TRUE)) stop("Package not found, cannot be installed") | |
} | |
} |
This file contains 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
BepaalBezetting <- function(DT_bezetting=kliniek) { | |
vecTime <- seq.POSIXt(min(DT_bezetting$Ingangsdatumtijd)-60, max(DT_bezetting$Einddatumtijd)+60, by = "mins") | |
Start <- setkey(DT_bezetting, Ingangsdatumtijd) | |
Start <- Start[J(vecTime),.N] # Per minuut, het aantal gestarte mutaties. | |
setnames(Start,"N","Start") # kolomnaam anders | |
setnames(Start,"Ingangsdatumtijd","Minuut") # kolomnaam anders | |
Eind <- setkey(DT_bezetting, Einddatumtijd) | |
Eind <- Eind[J(vecTime),.N] # Per minuut, het aantal gestarte mutaties. | |
setnames(Eind,"N","Eind") # kolomnaam anders | |
setnames(Eind,"Einddatumtijd","Minuut") # kolomnaam anders |