knitr::opts_chunk$set(echo = TRUE)
library(icons)
library(kableExtra)
knitr::include_graphics('../man/figures/DevCon_PPTBackground.jpg')

Welcome to DevCon2024! In the Hydrofabric Workshop we will use R and RStudio. Ideally, you will be able to follow along on your own laptop and it is preferable to have the software on your system before the session.

The document will help get R & RStudio on your own computer, along with several other useful tools or packages. If you have problems, you can contact Mike Johnson

Do you already have R installed?

If you have an older versions of R/RStudio installed, we recommend updating. You can check what version of R you are running by typing version in the console of RStudio.

version$version.string

To check your RStudio version in Windows, click the About RStudio menu option in the Help menu. To check on a Mac, click the About RStudio menu option in the RStudio menu.

If you don’t have at least R 4.4.XXX and RStudio 2023.6.0.XXXX. We suggest upgrading.

1. Getting R and RStudio

R is a programming language and free software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing. The R language is widely used for developing statistical software and data analysis. R also provides unparalleled opportunities for analyzing spatial data for spatial modeling.

RStudio is an integrated development environment (IDE) for R. Combined the R language and RStudio IDE provide the open-source, free, toolset for this course.

MacOS Install r fontawesome$brands$apple

Install R

Install RStudio


Windows Install r fontawesome$brands$windows

Install R

Install RStudio

2. Launch RStudio

Once both R and RStudio are installed, you can find and click on the RStudio icon to open the program. The RStudio icon looks like this:

knitr::include_graphics('../man/figures/rstudio-logo.png')

Opening RStudio will launch a workplace. If something like the below image appears for you, then you are all set!

knitr::include_graphics('../man/figures/rstudio-panels.png')

We will spend the session working in this IDE so the layout and features will become clear as we go. A few things to note now are:

Your layout and theme may not look like the above (all the elements are the same but arranged differently). If you want to change your theme and layout got to RStudio --> Preferences.

Here you can adjust the "Appearance" and "Pane Layout". If you want your to look like mine, see below:

knitr::include_graphics('../man/figures/rstudio-appearance.png')

3. Install NOAA-OWP/hydrofabric

R comes loaded with many base packages and tools. There are also many additional tools that will make your life easier. Throughout this session, we’ll use packages that exist in the aggregate hydrofabric package.

The hydrofabric contains a collection of very useful packages that play nicely together for data exploration, manipulation, wrangling and visualization (among other things). Packages can be installed from CRAN (Comprehensive R Archive Network) using the following pattern which should be typed in the console (r text_spec('yellow', color = "gold") box):

install.packages('powerjoin')
install.packages("remotes") 

In development package (yay DevCon!) can be installed from Github using the remotes package (installed above):

remotes::install_github("NOAA-OWP/hydrofabric")

Once it’s installed, you can ensure that everything worked by loading/attaching the hydrofabric libray using the library call:

library(hydrofabric)

If you got something similar to the above you’ve successfully installed R, RStudio, and the hydrofabric package!

If you really want to make sure you are ready, ensure you get all TRUE below:

hydrofabric_packages() %in% rownames(installed.packages()) 

Quick R Notes

## NOTE: What is glue?
x <- "Welcome to DevCon"
y <- "2024"
z <- c('2023', '2024', '2025', '...')

# single string
glue("{x} {y}")

# multiple strings from vectors
glue("{x} {z}")

```{bash, eval = F} ?read_hydrofabric

```r
knitr::include_graphics('../man/figures/help_doc.png')

4. Visit Lynker Spatial

Lynker spatial provides open data and software services aimed at improving user experience with hydrofabric allowing for rapid access, subsetting, and integration with other cloud native resources.

It's suggested to install the latest version of hfsubsetCLI from the release page for your specific operation system.

5. (Optional) Review Technical Background

If you are interested in the technical tools we use, how they are structured, and their application please review the Background document. While we will talk through this during the session, having a familiarity will help as we move (quickly) through them.

6. (Optional) Install QGIS

QGIS is a free and open-source geographic information system (GIS) software that allows users to visualize, analyze, and manage spatial data. You can install the binaries for your system directly from their website. Or using the following package managers.

MacOS

brew install qgis

Ubuntu/Debian

sudo apt update
sudo apt install qgis


NOAA-OWP/hydrofabric documentation built on Dec. 7, 2024, 11:24 a.m.