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
# 1. go to https://takeout.google.com/ | |
# 2. Deselect all "Products" | |
# 3. Select only the following product: Location History (Timeline) | |
# 4. Follow the other steps to get a json export of your Location history | |
# 5. Download and extract the data in your RStudio Project folder | |
# 6. Follow the script below | |
library(sf) |
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
library(readr) | |
library(tidyr) | |
library(sf) | |
library(dplyr) | |
library(purrr) | |
library(glue) | |
ullr2poly <- function(xmin, ymin, xmax, ymax){ | |
c(1,2,1,4,3,4,3,2,1,2) |> | |
sapply(\(x)c(xmin, ymin, xmax, ymax)[x]) |> | |
matrix(ncol = 2, byrow = 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
# from here: | |
# https://github.com/rstudio/gt/blob/ff878e10d21a3ba897c5f99801b796da8fb637fa/R/helpers.R#L2496-L2536 | |
adjust_luminance <- function(colors, steps) { | |
stopifnot(steps < 2, steps > -2) | |
rgb_matrix <- t(grDevices::col2rgb(colors, alpha = TRUE)) / 255 | |
alpha <- rgb_matrix[, "alpha"] | |
luv_matrix <- | |
grDevices::convertColor(rgb_matrix[, 1:3], "sRGB", "Luv") | |
h <- atan2(luv_matrix[, "v"], luv_matrix[, "u"]) * 180 / pi | |
c <- sqrt(luv_matrix[, "u"]^2 + luv_matrix[, "v"]^2) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.