-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* my workflow * example templates for manuscript. * manuscript info * update citations * cleanup text * cite * update readme * contribute * add website badge * update web link * Update README.md * Update README.md * add video link * auto update * utility files device specific * move the pdf generator to workflows * test error in paper.bib * test citation style * add citations * add a few more citations * try without space * add all * no spaces allowed in citation names * add demo images * Update paper.md * give images some space * image captions * add mention of wade * update authors and acknowledgements * Updated with Dan's Recs * Mary Comments #69 (comment) * SteveO comments #69 (review) * Walter's comments #69 (review) * Create config.yml * Create bug.yml * Create feature.yml * hyperlink * Update bug.yml * Update feature.yml * Added in Kristiina and Kris's comments * Update README.md * #69 (comment) * #69 (comment) * #69 (comment) * #69 (comment) * #69 (comment) * #69 (comment) * add kris's comments * add WSL2 link * Update paper.md * add acknowledgements * #69 (comment) * #69 (comment) * #69 (comment) * add submitted badge * update dois * Update paper.md #122 * Update paper.md add Elizabeth to ack * Update paper.md add funder possibility lab * Update paper.md add funder. * Update README.md * add r code for analyzing data * remove unnecessary code. * trying to fix the unexpected period issue, not sure where it is coming from. * revert bib to test * add dois * update paper acknowledgments and links. * add comments. * remove empty line * Update about.vue update about * Update about.vue add tutorial * Update README.md update video * Update paper.md update video
- Loading branch information
1 parent
4db6bfa
commit 402e595
Showing
6 changed files
with
76 additions
and
19 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#Working directory ---- | ||
setwd("notebooks/data_reader") #Change this to your working directory | ||
|
||
#Libraries ---- | ||
library(rio) | ||
library(jsonlite) | ||
library(ggplot2) | ||
library(data.table) | ||
|
||
# Data import ---- | ||
json_list <- import_list("example_data_download2.zip") | ||
|
||
# Get path of the summary table. | ||
summary_metadata <- names(json_list)[grepl("summary.json", names(json_list))] | ||
|
||
# Get path of the image metadata. | ||
image_metadata <- names(json_list)[!grepl("(.jpg)|(.png)|(.tif)|(schema)|(summary)", names(json_list))][-1] | ||
|
||
# Filter the summary data. | ||
summary_json <- json_list[[summary_metadata]] | ||
|
||
# Flatten the summary data. | ||
flattened_summary <- data.frame(name = summary_json$detected_objects$name, | ||
count = summary_json$detected_objects$count) | ||
# Filter the image data. | ||
image_json <- json_list[image_metadata] | ||
|
||
# Flatten the image data. | ||
flattened_images <- lapply(1:length(image_json), function(i){ | ||
print(i) | ||
data.frame(hash = image_json[[i]]$hash, | ||
filename = image_json[[i]]$filename, | ||
datetime = if(!is.null(image_json[[i]]$exifdata$DateTimeOriginal)){image_json[[i]]$exifdata$DateTimeOriginal} else{NA}, | ||
latitude = if(!is.null(image_json[[i]]$exifdata$GPSLatitude)){image_json[[i]]$exifdata$GPSLatitude} else{NA}, | ||
longitude = if(!is.null(image_json[[i]]$exifdata$GPSLongitude)){image_json[[i]]$exifdata$GPSLongitude} else{NA}, | ||
score = if(!is.null(image_json[[i]]$metadata$score)){image_json[[i]]$metadata$score} else{NA}, | ||
label = if(!is.null(image_json[[i]]$metadata$label)){image_json[[i]]$metadata$label} else{NA}) | ||
}) |> | ||
rbindlist() | ||
|
||
# Test equivalence in counts. | ||
nrow(flattened_images[!is.na(flattened_images$label),]) == sum(flattened_summary$count) | ||
|
||
# Figure creation ---- | ||
ggplot(flattened_summary, aes(y = reorder(name, count), x = count, fill = name)) + | ||
geom_bar(stat = "identity") + | ||
theme_classic(base_size = 15) + | ||
theme(legend.position = "none") + | ||
labs(x = "Count", y = "Type") | ||
|
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
Oops, something went wrong.