Skip to content

Instantly share code, notes, and snippets.

@ktaranov
Created September 23, 2020 07:36
Show Gist options
  • Save ktaranov/ea78cbf704a8cd34b07abb70756e18d9 to your computer and use it in GitHub Desktop.
Save ktaranov/ea78cbf704a8cd34b07abb70756e18d9 to your computer and use it in GitHub Desktop.
# Пакет работы с Excel файлами
library("openxlsx")
library("logging")
library("RODBC")
suppressPackageStartupMessages(library("data.table"))
loggerName <- "ge_dcast"
file_name <- "GE обр НТ_v06.xlsx"
loginfo(msg = "0 Start", logger = loggerName)
dt1 <- read.xlsx(xlsxFile = file_name,
sheet = 1,
colNames = TRUE,
detectDates = FALSE,
skipEmptyRows = FALSE
)
dt2 <- read.xlsx(xlsxFile = file_name,
sheet = 2,
colNames = TRUE,
detectDates = FALSE,
skipEmptyRows = FALSE
)
dt <- rbind(dt1, dt2)
rm(dt1, dt2)
setnames(dt, names(dt), as.character(c(1:length(dt))))
# dtCast <- dcast(
# data = dt,
# ExportCountry ~ YearMonth,
# fun = sum,
# value.var = c("Export", "Import")
# )
loginfo(msg = "End", logger = loggerName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment