Skip to content
Snippets Groups Projects
Commit 12914a52 authored by Mollenhorst, Erwin's avatar Mollenhorst, Erwin
Browse files

Initial script, loading first sheet

parent c69d557b
No related branches found
No related tags found
No related merge requests found
## remove (almost) everything in the working environment.
## You will get no warning, so don't do this unless you are really sure.
rm(list = ls())
# R version 4.2.1
# RStudio 2022.07.0+548
### ipak function: install and load multiple R packages.
### check to see if packages are installed. Install them if they are not,
### then load them into the R session.
IPAKCD <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
install.packages(new.pkg, dependencies = TRUE)
sapply(pkg, library, character.only = TRUE, logical.return = TRUE)
}
# Set working directory
IPAKCD(c("rstudioapi", "data.table", "openxlsx", "dplyr"))
setwd(dirname(getActiveDocumentContext()$path))
getwd()
# Inlezen Sheet voorraden file
vDataVrd <- read.xlsx(xlsxFile = "data/20220811_MeststromenData.xlsx",
sheet = "Begin en Eindvoorraad")
vDataVrd$CodeCat <- as.factor(paste(vDataVrd$Mestcode, vDataVrd$Mestcategorie))
summary(vDataVrd$CodeCat)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment