Add location_barnett prefix to location features
parent
c6ff0346f4
commit
c4d9702a5c
|
@ -4,21 +4,21 @@ library(dplyr)
|
||||||
|
|
||||||
write_empty_file <- function(file_path, metrics_to_include){
|
write_empty_file <- function(file_path, metrics_to_include){
|
||||||
write.csv(data.frame(local_date= character(),
|
write.csv(data.frame(local_date= character(),
|
||||||
hometime= numeric(),
|
location_barnett_hometime= numeric(),
|
||||||
disttravelled= numeric(),
|
location_barnett_disttravelled= numeric(),
|
||||||
rog= numeric(),
|
location_barnett_rog= numeric(),
|
||||||
maxdiam= numeric(),
|
location_barnett_maxdiam= numeric(),
|
||||||
maxhomedist= numeric(),
|
location_barnett_maxhomedist= numeric(),
|
||||||
siglocsvisited= numeric(),
|
location_barnett_siglocsvisited= numeric(),
|
||||||
avgflightlen= numeric(),
|
location_barnett_avgflightlen= numeric(),
|
||||||
stdflightlen= numeric(),
|
location_barnett_stdflightlen= numeric(),
|
||||||
avgflightdur= numeric(),
|
location_barnett_avgflightdur= numeric(),
|
||||||
stdflightdur= numeric(),
|
location_barnett_stdflightdur= numeric(),
|
||||||
probpause= numeric(),
|
location_barnett_probpause= numeric(),
|
||||||
siglocentropy= numeric(),
|
location_barnett_siglocentropy= numeric(),
|
||||||
minsmissing= numeric(),
|
location_barnett_minsmissing= numeric(),
|
||||||
circdnrtn= numeric(),
|
location_barnett_circdnrtn= numeric(),
|
||||||
wkenddayrtn= numeric()
|
location_barnett_wkenddayrtn= numeric()
|
||||||
) %>% select(metrics_to_include), file_path, row.names = F)
|
) %>% select(metrics_to_include), file_path, row.names = F)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ accuracy_limit <- snakemake@params[["accuracy_limit"]]
|
||||||
timezone <- snakemake@params[["timezone"]]
|
timezone <- snakemake@params[["timezone"]]
|
||||||
metrics_to_include <- intersect(unlist(snakemake@params["metrics"], use.names = F),
|
metrics_to_include <- intersect(unlist(snakemake@params["metrics"], use.names = F),
|
||||||
c("hometime","disttravelled","rog","maxdiam","maxhomedist","siglocsvisited","avgflightlen","stdflightlen","avgflightdur","stdflightdur","probpause","siglocentropy","minsmissing","circdnrtn","wkenddayrtn"))
|
c("hometime","disttravelled","rog","maxdiam","maxhomedist","siglocsvisited","avgflightlen","stdflightlen","avgflightdur","stdflightdur","probpause","siglocentropy","minsmissing","circdnrtn","wkenddayrtn"))
|
||||||
metrics_to_include <- c("local_date", metrics_to_include)
|
metrics_to_include <- c("local_date", paste("location_barnett", metrics_to_include, sep = "_"))
|
||||||
|
|
||||||
# By deafult we use all raw locations: fused without resampling and not fused (gps, network)
|
# By deafult we use all raw locations: fused without resampling and not fused (gps, network)
|
||||||
location <- read.csv(snakemake@input[["raw"]], stringsAsFactors = F) %>%
|
location <- read.csv(snakemake@input[["raw"]], stringsAsFactors = F) %>%
|
||||||
|
@ -56,7 +56,7 @@ if (nrow(location) > 1){
|
||||||
outmatrix <- cbind(rownames(features$featavg), features$featavg)
|
outmatrix <- cbind(rownames(features$featavg), features$featavg)
|
||||||
outmatrix <- as.data.frame(outmatrix)
|
outmatrix <- as.data.frame(outmatrix)
|
||||||
outmatrix[-1] <- lapply(lapply(outmatrix[-1], as.character), as.numeric)
|
outmatrix[-1] <- lapply(lapply(outmatrix[-1], as.character), as.numeric)
|
||||||
colnames(outmatrix)=c("local_date",tolower(colnames(features$featavg)))
|
colnames(outmatrix)=c("local_date",tolower(paste("location_barnett", colnames(features$featavg), sep = "_")))
|
||||||
write.csv(outmatrix %>% select(metrics_to_include), snakemake@output[[1]], row.names = F)
|
write.csv(outmatrix %>% select(metrics_to_include), snakemake@output[[1]], row.names = F)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue