which git/usr/bin/git
EVR 628- Intro to Environmental Data Science
The overall flow:
which git/usr/bin/git
git config -lcredential.helper=osxkeychain
init.defaultbranch=main
user.email=juancarlos.villader@gmail.com
user.name=jcvdav
core.excludesfile=~/.gitignore
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.postbuffer=157286400
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/jcvdav/EVR_628.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.main.remote=origin
branch.main.merge=refs/heads/main
branch.main.vscode-merge-base=origin/main
pull.rebase=true
branch.dev.remote=origin
branch.dev.merge=refs/heads/dev
branch.test.remote=origin
branch.test.merge=refs/heads/test
You should see your user.name and user.email listed, typically at the bottom.
+” icon in the top rightEVR_628In RStudio:
README.md and .gitignore filesTo create these folders in your repository:
environmental-data-project/
├── data/
│ ├── raw/
│ ├── processed/
| └── output/
├── scripts/
│ ├── 01_processing/
│ ├── 02_analysis/
│ └── 03_content/
├── results/
│ ├── img/
│ └── tab/
├── docs/
└── README.md
Use:
EVR628tools::create_dirs()When you only want to use a function from a package, we can avoid loading the library with library(package_name) and instead directly access the function via it’s namespace. Here, we say package_name::function_name().
usethis::git_vaccinate()?usethis::git_vaccinate()usethis::git_vaccinate()You can always add specific files or folders by editing the .gitignore file or using the git pane
scripts/content/my_first_plot.R# Load packages
library(EVR628tools)✔ ✔ ✔ You sucessfully loaded the EVR628tools package ✔ ✔ ✔
library(tidyverse)── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.3 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# Load data
data(data_lionfish)
# Create a simple plot
p <- ggplot(data_lionfish,
aes(x = total_length_mm, y = total_weight_gr)) +
geom_point()
p# Save plot
# The above shouldn't work, why?
ggsave(plot = p, filename = "results/figures/first_plot.png")Error in `ggsave()`:
! Cannot find directory 'results/figures'.
ℹ Please supply an existing directory or use `create.dir = TRUE`.
Create a comprehensive README.md
# My repo for EVR 628
## Author
[Your Name and email? GitHub username?]
## Description
Analysis of environmental data for EVR 628 course.
## Project Structure
- `scripts/`: R scripts for analysis
- `results/`: Output figures and tables… wait until partner B tells you…
xlab(Total Length (mm)) or color = "blue"…)Changes to make by B:
# Example: environmental_data_analysis.R
library(EVR628tools)
library(tidyverse)
data(data_lionfish)
# Create a simple plot
p <- ggplot(data_lionfish,
aes(x = total_length_mm, y = total_weight_gr)) +
geom_point(color = "blue") + # <--- This is one change
xlab("Total Length (cm)") # <--- This is another change
p