Created
June 10, 2020 13:13
-
-
Save jarvisc1/98fc320712327f6ca2b6343a1afeb59d to your computer and use it in GitHub Desktop.
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(skimr) | |
skim(mtcars) | |
skim_mtcars <- skim(mtcars) | |
names(skim_mtcars) | |
summary(skim_mtcars) | |
skim(mtcars, mpg) | |
mtcars %>% | |
dplyr::group_by(gear) %>% | |
skim | |
## Cubeview | |
# View raster over time and space | |
library(cubeview) | |
library(raster) | |
kili_data <- system.file("extdata", "kiliNDVI.tif", package = "cubeview") | |
kiliNDVI <- stack(kili_data) | |
# | |
# The location of the slices can be controlled by keys: | |
# x-axis: LEFT / RIGHT arrow key | |
# y-axis: DOWN / UP arrow key | |
# z-axis: PAGE_DOWN / PAGE_UP key | |
# Other controls: | |
# Press and hold left mouse-button to rotate the cube. | |
# Press and hold right mouse-button to move the cube. | |
# Spin mouse-wheel or press and hold middle mouse-button and move mouse down/up to zoom the cube. | |
# Press space bar to show/hide slice position guides. | |
cubeview(kiliNDVI) | |
## Mapedit and Mapview - interactive maps and drawing stuff | |
library(mapview) | |
library(mapedit) | |
library(sf) | |
# Show map | |
mapview(breweries) | |
# Draw new objects | |
lf <- mapview() | |
drawing <- lf %>% | |
editMap() | |
names(drawing) | |
mapview(drawing$finished) | |
# Edit features | |
changedfeatures <- editFeatures(drawing$finished) | |
mapview(changedfeatures) | |
## Rayshader | |
library(rayshader) | |
#Here, I load a map with the raster package. | |
loadzip = tempfile() | |
download.file("https://tylermw.com/data/dem_01.tif.zip", loadzip) | |
localtif = raster::raster(unzip(loadzip, "dem_01.tif")) | |
unlink(loadzip) | |
#And convert it to a matrix: | |
elmat = raster_to_matrix(localtif) | |
elmat %>% | |
sphere_shade(texture = "desert") %>% | |
add_water(detect_water(elmat), color = "desert") %>% | |
add_shadow(ray_shade(elmat, zscale = 3), 0.5) %>% | |
add_shadow(ambient_shade(elmat), 0) %>% | |
plot_3d(elmat, zscale = 10, fov = 0, theta = 135, zoom = 0.75, phi = 45, windowsize = c(1000, 800)) | |
## Beepr - make noises in R | |
library(beepr) | |
beep(5) | |
# installr - Update to a new version of R | |
installr::updateR() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment