\[~\]

\[~\]

\[\underline{STILL \space UNDER \space CONSTRUCTION}\]

\[~\]

\[~\]

Summary


R Code

Cheatsheets

Base R Colors

ggplot2

Base R

here

  • function in the here package that creates file paths to the folder where the R Project file is
install.packages('here')
library(here)
here()

# to build a file path to a specific file
file.path(here(), 'data_raw', 'data file to be called')

Factorize

  • function to convert multiple character variables within a data frame into factors
Factorize <- function(data, columns) {
  for (i in 1:length(columns)) {
    data[, columns[i]] <- as.factor(data[, columns[i]])
  }
  return(data)
}

not_all_NA

  • check if a vector is all NA values. Will return FALSE if there are ONLY NA values in the vector.
not_all_NA <- function (x) {
  any(!is.na(x))
}

row_max

  • determines maximum value of the rows of a data frame
row_max <- function(data, na.rm = FALSE) {
  out <- NULL
  for (i in 1:nrow(data)) {
    if (any(!is.na(data[i, ]))) {
      out <- c(out, max(data[i, ], na.rm = na.rm))
    } else {
      out <- c(out, NA)
    }
  }
  return(out)
}

stndrd

  • standardizes numeric variables of a data frame by mean centering and dividing by the standard deviation
stndrd <- function(vars, data) {
  for (i in 1:length(vars)) {
    data[, vars[i]] <- (data[, vars[i]] - mean(data[, vars[i]], na.rm = TRUE)) / sd(data[, vars[i]], na.rm = TRUE)
  }
  return(data)
}

\[~\]

Tidyverse


Bash


Python


Google Earth Engine


Glossary

References

Additional Resources


  1. Temple University, ↩︎

  2. Temple University, ↩︎

  3. Temple University, ↩︎

  4. Temple University, ↩︎