-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ebb679a
Showing
172 changed files
with
20,138 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^doc$ | ||
^docs$ | ||
^Meta$ | ||
^\.github$ | ||
^README.Rmd | ||
^LICENSE.md | ||
^_pkgdown.yml | ||
^hexlogo_transparent.png | ||
^pkgdown |
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 @@ | ||
*.html |
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,49 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: R-CMD-check | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: macos-latest, r: 'release'} | ||
- {os: windows-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | ||
- {os: ubuntu-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'oldrel-1'} | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
http-user-agent: ${{ matrix.config.http-user-agent }} | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck | ||
needs: check | ||
|
||
- uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true |
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,48 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
name: pkgdown | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
# Only restrict concurrency for non-PR jobs | ||
concurrency: | ||
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::pkgdown, local::. | ||
needs: website | ||
|
||
- name: Build site | ||
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | ||
shell: Rscript {0} | ||
|
||
- name: Deploy to GitHub pages 🚀 | ||
if: github.event_name != 'pull_request' | ||
uses: JamesIves/github-pages-deploy-action@v4.4.1 | ||
with: | ||
clean: false | ||
branch: gh-pages | ||
folder: docs |
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 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: test-coverage | ||
|
||
jobs: | ||
test-coverage: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::covr | ||
needs: coverage | ||
|
||
- name: Test coverage | ||
run: | | ||
covr::codecov( | ||
quiet = FALSE, | ||
clean = FALSE, | ||
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") | ||
) | ||
shell: Rscript {0} | ||
|
||
- name: Show testthat output | ||
if: always() | ||
run: | | ||
## -------------------------------------------------------------------- | ||
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true | ||
shell: bash | ||
|
||
- name: Upload test results | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-test-failures | ||
path: ${{ runner.temp }}/package |
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,6 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata | ||
/doc/ | ||
/Meta/ |
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,37 @@ | ||
Package: quadkeyr | ||
Title: Tools to convert QuadKeys utilized in Microsoft's Bing Maps Tile System into raster images | ||
Version: 0.0.0.9000 | ||
Authors@R: | ||
person(given = "Florencia", | ||
family = "D'Andrea", | ||
email = "florencia.dandrea@gmail.com", | ||
role = c("aut", "cre"), | ||
comment = c(ORCID = "0000-0002-0041-097X")) | ||
Description: quadkeyr enables the generation of raster images based on QuadKeys, facilitating efficient integration of Bing Maps data into R workflows. In particular, quadkeyr provides support to process and analyze Facebook mobility datasets within the R environment. | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.2.1 | ||
Suggests: | ||
knitr, | ||
rmarkdown, | ||
testthat (>= 3.1.10) | ||
VignetteBuilder: knitr | ||
Depends: | ||
R (>= 2.10) | ||
LazyData: true | ||
Imports: | ||
bslib (>= 0.5.1), | ||
dplyr (>= 1.1.2), | ||
DT (>= 0.27), | ||
ggplot2 (>= 3.4.3), | ||
leaflet (>= 2.2.0), | ||
lubridate (>= 1.9.2), | ||
purrr (>= 1.0.1), | ||
readr (>= 2.1.4), | ||
rnaturalearth (>= 0.3.2), | ||
sf (>= 1.0.14), | ||
shiny (>= 1.7.4), | ||
stars (>= 0.6.2), | ||
tidyr (>= 1.3.0), | ||
viridis (>= 0.6.4) |
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,2 @@ | ||
YEAR: 2023 | ||
COPYRIGHT HOLDER: quadkeyr authors |
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,21 @@ | ||
# MIT License | ||
|
||
Copyright (c) 2023 quadkeyr authors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,25 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(apply_weekly_lag) | ||
export(clip) | ||
export(complete_grid_for_polygons) | ||
export(create_qk_grid) | ||
export(create_raster) | ||
export(extract_qk_coord) | ||
export(extract_tile_coord) | ||
export(format_data) | ||
export(grid_to_polygon) | ||
export(ground_res) | ||
export(latlong_to_pixelXY) | ||
export(mapscale) | ||
export(mapsize) | ||
export(missing_combinations) | ||
export(pixelXY_to_latlong) | ||
export(pixelXY_to_tileXY) | ||
export(polygon_to_raster) | ||
export(quadkey_to_latlong) | ||
export(quadkey_to_tileXY) | ||
export(read_all_files) | ||
export(regular_qk_grid) | ||
export(tileXY_to_pixelXY) | ||
export(tileXY_to_quadkey) |
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,40 @@ | ||
#' Apply a 7 day lag to the variable n_crisis | ||
#' | ||
#' @description Applying a week lag to the data will create rasters showing how | ||
#' people was moving a week ago the date of interest. This function works only | ||
#' for quadkeys without NAs. | ||
#' | ||
#' @param data A dataset | ||
#' | ||
#' @return A dataframe with the extra colums n_crisis_lag_7 and n_crisis_percent_7 | ||
#' @export | ||
#' | ||
#' @examples | ||
#' | ||
#' data <- result_read_all_files | ||
#' apply_weekly_lag(data) | ||
#' | ||
apply_weekly_lag <- function(data){ | ||
|
||
out_data <- c() | ||
|
||
for(i in unique(data$quadkey)){ | ||
|
||
inter <- data |> | ||
dplyr::filter(quadkey == i) | ||
|
||
# I am only considering cases where there have not been NAs | ||
if(!is.na(sum(inter$n_crisis))){ | ||
|
||
quadkey_lag <- inter |> | ||
dplyr::group_by(quadkey, time) |> | ||
dplyr::mutate(n_crisis_lag_7 = dplyr::lag(as.numeric(n_crisis), n = 7)) |> | ||
dplyr::mutate(percent_change_7 = ((n_crisis_lag_7 - n_crisis)/n_crisis) * 100) | ||
|
||
out_data <- rbind(out_data, quadkey_lag) | ||
|
||
} | ||
} | ||
|
||
return(out_data) | ||
} |
Oops, something went wrong.