Last updated: 2021-09-30
Checks: 7 0
Knit directory: Test/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20210926)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version f4989ba. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: data/json/
Ignored: data/plan/
Ignored: workflowr.R
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/09-27.Rmd
) and HTML (docs/09-27.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
html | 8cd6144 | cfcforever | 2021-09-29 | Build site. |
Rmd | 3ebdc7c | cfcforever | 2021-09-28 | some changes |
html | 6289c69 | cfcforever | 2021-09-28 | Build site. |
html | f8288b3 | cfcforever | 2021-09-28 | Build site. |
html | 2846b2e | cfcforever | 2021-09-28 | Build site. |
html | 72db555 | cfcforever | 2021-09-28 | Build site. |
Rmd | eac5eb1 | cfcforever | 2021-09-28 | add the new analysis |
html | 52bf4a0 | cfcforever | 2021-09-28 | Build site. |
Rmd | a6c4cce | cfcforever | 2021-09-28 | add the new analysis |
today = "2021-09-27"
cat("data on:", today, "\n")
data on: 2021-09-27
json_data = fromJSON(file = paste0("data/json/", today, "/position.json"))
cat("Total collected positions: ", length(json_data), "\n")
Total collected positions: 958230
tagId_seq = unlist(lapply(json_data, function(x){x["tag_id"][[1]]}))
tagId = unique(tagId_seq)
nb_tag = length(tagId)
cat("Tags are: ", tagId, "\n")
Tags are: 28d2 2f77 0db4 2e55 2f7b 2c57 0da6 2e8d 2f40 0d82 2b9c 0baf 2a51 19ab 2e5b 2c5d
table(tagId_seq)
tagId_seq
0baf 0d82 0da6 0db4 19ab 28d2 2a51 2b9c 2c57 2c5d 2e55
50092 50176 50057 163868 41645 49719 50022 198074 50135 422 49662
2e5b 2e8d 2f40 2f77 2f7b
432 13436 49155 96091 45244
dat <- data.frame(tag = unlist(lapply(json_data, function(x){x["tag_id"][[1]]})),
x = unlist(lapply(json_data, function(x){x["x"][[1]]})),
y = unlist(lapply(json_data, function(x){x["y"][[1]]})),
record_timestamp = unlist(lapply(json_data, function(x){x["record_timestamp"][[1]]})))
dat = dat[order(dat$record_timestamp),]
dat = cbind.data.frame(dat, convert_date(dat$record_timestamp))
dat$x = as.numeric(dat$x)
dat$y = as.numeric(dat$y)
names_tag <- read.table(file = "data/tag_names_20210924.txt", header = T, sep = "\t")
names_tag = names_tag[names_tag$id%in%tagId, ]
tagId = names_tag$id
nb_tag = length(tagId)
dat = dat[dat$tag%in%tagId,]
dat$label = factor(dat$tag, levels = names_tag$id, labels = names_tag$label)
list_tag <- split(dat, dat$tag)
table_tag <- data.frame(tag = names_tag$id, label = names_tag$label)
table_tag$first_record = NA
table_tag$last_record = NA
table_tag$number = NA
table_tag$number_NA = NA
table_tag$ratio_non_NA = NA
table_tag$freq_1Q = NA
table_tag$freq_median = NA
table_tag$freq_3Q = NA
for (k in 1:nb_tag){
tag = table_tag$tag[k]
temp = list_tag[tag][[1]]
temp$diff_ts = c(0, temp$record_timestamp[-1]-temp$record_timestamp[-nrow(temp)])
table_tag$first_record[k] = head(as.character(temp$date),1)
table_tag$last_record[k] = tail(as.character(temp$date),1)
table_tag$number[k] = nrow(temp)
table_tag$number_NA[k] = sum(is.na(temp$x))
table_tag$ratio_non_NA[k] = round(1-table_tag$number_NA[k]/table_tag$number[k],2)
table_tag$freq_1Q[k] = round(quantile(temp$diff_ts, 0.25), 3)
table_tag$freq_median[k] = round(quantile(temp$diff_ts, 0.5), 3)
table_tag$freq_3Q[k] = round(quantile(temp$diff_ts, 0.75), 3)
}
kable(table_tag) %>%
kable_styling(bootstrap_options = "striped", full_width = F)
tag | label | first_record | last_record | number | number_NA | ratio_non_NA | freq_1Q | freq_median | freq_3Q |
---|---|---|---|---|---|---|---|---|---|
2a51 | BLA | 2021-09-27 06:23:11 | 2021-09-27 23:59:59 | 50022 | 72 | 1.00 | 0.545 | 0.594 | 0.645 |
0da6 | BRA1 | 2021-09-27 06:25:17 | 2021-09-27 23:59:59 | 50057 | 285 | 0.99 | 0.544 | 0.594 | 0.646 |
2f7b | BRA2 | 2021-09-27 06:25:55 | 2021-09-27 23:59:59 | 45244 | 454 | 0.99 | 0.545 | 0.596 | 0.652 |
2f40 | BRA4 | 2021-09-27 06:27:38 | 2021-09-27 23:59:59 | 49155 | 4713 | 0.90 | 0.552 | 0.593 | 0.642 |
2f77 | BRP1 | 2021-09-27 08:29:44 | 2021-09-27 23:59:59 | 96091 | 2269 | 0.98 | 0.200 | 0.442 | 0.595 |
2b9c | BRP2 | 2021-09-27 06:25:10 | 2021-09-27 23:59:59 | 198074 | 3689 | 0.98 | 0.200 | 0.200 | 0.259 |
0d82 | CDS1 | 2021-09-27 06:23:11 | 2021-09-27 23:59:59 | 50176 | 40 | 1.00 | 0.540 | 0.594 | 0.651 |
2c57 | DYN1 | 2021-09-27 06:25:15 | 2021-09-27 23:59:59 | 50135 | 11408 | 0.77 | 0.541 | 0.593 | 0.649 |
2e8d | DYN3 | 2021-09-27 07:05:21 | 2021-09-27 23:59:59 | 13436 | 42 | 1.00 | 0.583 | 0.638 | 0.691 |
0baf | ELC | 2021-09-27 06:23:11 | 2021-09-27 23:59:59 | 50092 | 385 | 0.99 | 0.539 | 0.594 | 0.670 |
0db4 | FAU | 2021-09-27 08:02:04 | 2021-09-27 23:59:59 | 163868 | 46281 | 0.72 | 0.200 | 0.200 | 0.536 |
28d2 | ORD | 2021-09-27 06:23:17 | 2021-09-27 23:59:59 | 49719 | 905 | 0.98 | 0.546 | 0.594 | 0.647 |
2e55 | SCO | 2021-09-27 06:23:11 | 2021-09-27 23:59:59 | 49662 | 555 | 0.99 | 0.543 | 0.593 | 0.647 |
timestamp_breaks = as.numeric(as.POSIXct(paste0(today, " ", sprintf("%02d", 0:23), ":00:00 CEST"))) + 3600*6
p <- ggplot(dat) + theme_bw() +
geom_point(aes(x=record_timestamp, y=label, col=label)) +
scale_x_continuous(breaks = timestamp_breaks, labels = 0:23) +
coord_cartesian(xlim = c(timestamp_breaks[1], timestamp_breaks[23]+3600)) +
theme(legend.position = "None") +
labs(x = "hour", y = "", title = today)
print(p)
Version | Author | Date |
---|---|---|
8cd6144 | cfcforever | 2021-09-29 |
x_na = which(is.na(dat$x))
y_na = which(is.na(dat$y))
cat("if x_na = y_na:", identical(x_na, y_na), "\n")
if x_na = y_na: TRUE
cat("number of NA positions:", length(x_na), "/", length(tagId_seq), "(=",
length(x_na)/length(tagId_seq)*100, "%)", "\n")
number of NA positions: 71098 / 958230 (= 7.419722 %)
if (length(x_na)!=0){
dat = dat[-x_na,]
}
timestamp_breaks = as.numeric(as.POSIXct(paste0(today, " ", sprintf("%02d", 0:23), ":00:00 CEST"))) + 3600*6
p <- ggplot(dat) + theme_bw() +
geom_point(aes(x=record_timestamp, y=label, col=label)) +
scale_x_continuous(breaks = timestamp_breaks, labels = 0:23) +
coord_cartesian(xlim = c(timestamp_breaks[1], timestamp_breaks[23]+3600)) +
theme(legend.position = "None") +
labs(x = "hour", y = "", title = today)
print(p)
Version | Author | Date |
---|---|---|
8cd6144 | cfcforever | 2021-09-29 |
list_tag <- split(dat, dat$tag)
for (tag in names(list_tag)){
if (!is.null(list_tag[tag][[1]])){
dd = list_tag[tag][[1]]
dd[,c("x","y")] = dd[,c("x","y")]/100
rownames(dd) = 1:nrow(dd)
dd$num = 1:nrow(dd)
dd$timediff = c(0, dd$record_timestamp[-1] - dd$record_timestamp[-nrow(dd)])
list_tag[tag][[1]] = dd
}
}
dat = do.call(rbind.data.frame, list_tag)
plan <- read_excel("data/plan/Wall_lignes_firminy.xlsx")
plan = as.data.frame(plan)
plan$`Start X` <- as.numeric(plan$`Start X`)/100
plan$`Start Y` <- as.numeric(plan$`Start Y`)/100
plan$`End X` <- as.numeric(plan$`End X`)/100
plan$`End Y` <- as.numeric(plan$`End Y`)/100
colnames(plan) = c("Name", "Length", "Linetype Scale", "Angle", "Delta X",
"Delta Y", "Delta Z", "EndX", "EndY", "EndZ",
"StartX", "StartY", "StartZ")
p <- ggplot(plan) + theme_bw() +
geom_segment(aes(x=StartX, y=StartY, xend=EndX, yend=EndY))
for (k in 1:nb_tag){
tag = names_tag$id[k]
label = names_tag$label[k]
cat("\n")
cat("## ", label, "\n")
dd = list_tag[tag][[1]]
q <- p +
geom_point(data = dd, aes(x=x,y=y), col="red", size = 1) +
coord_equal(ratio = 1, xlim = c(-35,5), ylim = c(-60,5)) +
labs(x = "", y = "", title = paste0(tag, " - ", names_tag$Matériel[names_tag$id==tag]))
print(q)
cat("\n")
}
Version | Author | Date |
---|---|---|
8cd6144 | cfcforever | 2021-09-29 |
sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] zh_CN.UTF-8/zh_CN.UTF-8/zh_CN.UTF-8/C/zh_CN.UTF-8/zh_CN.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readxl_1.3.1 lubridate_1.7.10 dplyr_1.0.5 nnet_7.3-15
[5] kableExtra_1.3.4 rjson_0.2.20 cowplot_1.1.1 gganimate_1.0.7
[9] ggplot2_3.3.3 workflowr_1.6.2
loaded via a namespace (and not attached):
[1] progress_1.2.2 tidyselect_1.1.0 xfun_0.22 bslib_0.2.4
[5] purrr_0.3.4 colorspace_2.0-0 vctrs_0.3.7 generics_0.1.0
[9] viridisLite_0.4.0 htmltools_0.5.1.1 yaml_2.2.1 utf8_1.2.1
[13] rlang_0.4.10 jquerylib_0.1.3 later_1.1.0.1 pillar_1.6.0
[17] glue_1.4.2 withr_2.4.1 tweenr_1.0.2 lifecycle_1.0.0
[21] stringr_1.4.0 cellranger_1.1.0 munsell_0.5.0 gtable_0.3.0
[25] rvest_1.0.0 evaluate_0.14 labeling_0.4.2 knitr_1.32
[29] httpuv_1.5.5 fansi_0.4.2 highr_0.8 Rcpp_1.0.6
[33] promises_1.2.0.1 scales_1.1.1 webshot_0.5.2 jsonlite_1.7.2
[37] systemfonts_1.0.1 farver_2.1.0 fs_1.5.0 hms_1.0.0
[41] digest_0.6.27 stringi_1.5.3 grid_4.0.5 rprojroot_2.0.2
[45] tools_4.0.5 magrittr_2.0.1 sass_0.3.1 tibble_3.1.0
[49] crayon_1.4.1 whisker_0.4 pkgconfig_2.0.3 ellipsis_0.3.1
[53] xml2_1.3.2 prettyunits_1.1.1 svglite_2.0.0 rmarkdown_2.10
[57] httr_1.4.2 rstudioapi_0.13 R6_2.5.0 git2r_0.28.0
[61] compiler_4.0.5