This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(dplyr)
library(tidyr)
library(ggplot2)
library(leaflet)
library(DT)
#remove.packages("sf")
#install.packages("sf")
#install.packages("e1071")
library(sf)
#install.packages("terra")
library(terra)
#install.packages("spData")
library(spData)
#install.packages("spDataLarge", repos="https://nowosad.r-universe.dev")
library(spDataLarge)
library(raster)
library(tmap)
library(tidyverse)
#shell("dir c:/Users/Andreas/class/NASA", translate=TRUE)
shell("c:/Users/Andreas/class/NASA/nasa0.cmd", translate=TRUE)
omg <- read.csv("c:/Users/Andreas/class/NASA/output.dat",sep=",")
#omg
ggplot(omg,aes(x=Depth,y=Temp,group=Cast)) +
geom_path() +
ylim(c(-1.5,6.5)) +
xlim(c(500,0)) +
ylab("Temperature, C") +
xlab("Depth, m") +
coord_flip(expand=FALSE) +
facet_wrap(~Cast)
## Warning: Removed 1064 row(s) containing missing values (geom_path).
ggplot(omg,mapping=aes(x=Depth,y=Sal,group=Cast)) +
geom_line() +
ylim(c(30,35)) +
xlim(c(500,0)) +
ylab("Salinity, psu") +
coord_flip(expand=FALSE) +
facet_wrap(~Cast)
## Warning: Removed 1373 row(s) containing missing values (geom_path).
ggplot(omg,mapping=aes(x=Sal,y=Temp,group=Cast,color=Depth)) +
geom_point() +
xlim(c(30,35)) +
ylim(c(-1.5,6.5)) +
xlab("Salinity, psu") +
ylab("Temperature, C") +
scale_color_viridis_c(guide=guide_colorbar(barheight=15)) +
facet_wrap(~Cast)
## Warning: Removed 1177 rows containing missing values (geom_point).
names(world)
## [1] "iso_a2" "name_long" "continent" "region_un" "subregion" "type"
## [7] "area_km2" "pop" "lifeExp" "gdpPercap" "geom"
#plot(world["pop"])
greenland = world[world$name_long == "Greenland",]
plot(st_geometry(greenland), expandBB=c(0,0.2,0.1,1),col="gray",lwd=3)
world_europe = world[world$continent == "Europe",]
world_america = world[world$region_un == "Americas",]
plot(world_europe[0],add=TRUE)
plot(world_america[0],add=TRUE)
point1 = st_point(c(300,60))
plot(point1,add=TRUE)
label = c("Cast-1", "Cast-2","Cast-3")
leaflet() %>%
addProviderTiles("NASAGIBS.ViirsEarthAtNight2012") %>%
addMarkers(lng = c(-60,-30,0),
lat = c(70,70,70),
popup = label)
tm_shape(world) +
tm_fill(col="pop",alpha=0.3) +
tm_borders(lwd=0.5)