R/Demo2.R

library(ggplot2)
library(dplyr)
library(tidyverse)
library(readxl)

#Read data
f <- read_excel("/Users/huayuzhang/Downloads/GEOG379/Difference.xlsx")

#Data cleaning
f <- f %>% select(c(1,11)) %>% as.data.frame() %>%
  slice(-c(1,2, 22))
colnames(f) <- cbind("year", "cells")
f$year <- as.factor(f$year)
f$cells <- as.numeric(f$cells)


# Create barplot for the difference of two datasets
p <- ggplot(f, aes(x = year, y = cells)) +
  geom_bar(stat = "identity") +
  ggtitle("The difference of cells between two datasets")

p
DrBo0m/PontiR documentation built on Dec. 17, 2021, 5:29 p.m.