• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版1b8f8131ba0dc385fea00ebe92177b6143f274e7 (tree)
时间2022-12-12 22:59:07
作者Lorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

Code seld-contained.

更改概述

差异

diff -r 753a0d2ce999 -r 1b8f8131ba0d R-codes/arima_simple2_parallel.R
--- a/R-codes/arima_simple2_parallel.R Mon Dec 12 14:58:47 2022 +0100
+++ b/R-codes/arima_simple2_parallel.R Mon Dec 12 14:59:07 2022 +0100
@@ -14,7 +14,6 @@
1414 tidymodels_prefer()
1515
1616
17-source("/home/lorenzo/myprojects-hg/R-codes/stat_lib.R")
1817
1918
2019 extract_ms_data <- function( ms, log_trans){
@@ -47,6 +46,43 @@
4746 }
4847
4948
49+su <- function(x, decreasing=F, ...){
50+
51+ ## res <- x %>% unique %>% sort(decreasing=decreasing, ...)
52+
53+ res <- x |>
54+ unique() |>
55+ sort(decreasing=decreasing, ...)
56+
57+
58+ return(res)
59+
60+
61+}
62+
63+
64+save_excel <- function(output, fileName, sheetName="data", na_yes = TRUE,...){
65+tryCatch({
66+
67+ wb <- loadWorkbook(fileName)
68+ addWorksheet(wb = wb, sheet = sheetName)
69+ writeData(wb = wb, sheet = sheetName, x = output, colNames = T, rowNames = F,
70+ keepNA=na_yes ,...)
71+ saveWorkbook(wb = wb, file = fileName, overwrite = T)
72+},
73+error = function(err){
74+
75+ wb <- createWorkbook(fileName)
76+ addWorksheet(wb = wb, sheet = sheetName)
77+ writeData(wb = wb, sheet = sheetName, x = output, colNames = T, rowNames = F, keepNA=na_yes , ... )
78+ saveWorkbook(wb = wb, file = fileName, overwrite = T)
79+})
80+}
81+
82+
83+
84+
85+
5086 ###################################################################
5187 ###################################################################
5288 ###################################################################
@@ -65,6 +101,24 @@
65101
66102 choose_log <- 1
67103
104+iso_map_eu27 <- tibble(iso3=c("AUT", "BEL", "BGR", "CYP", "CZE", "DEU", "DNK", "ESP", "EST", "FIN",
105+"FRA",
106+"GRC", "HRV", "HUN", "IRL", "ITA", "LTU", "LUX", "LVA", "MLT",
107+"NLD", "POL", "PRT",
108+"ROM", "SVK", "SVN", "SWE"),
109+iso2 = c("AT", "BE", "BG", "CY", "CZ","DE",
110+ "DK", "ES" ,"EE", "FI", "FR", "EL", "HR", "HU", "IE",
111+ "IT" , "LT","LU", "LV", "MT", "NL", "PL",
112+ "PT", "RO", "SK", "SI", "SE"),
113+
114+country=c("Austria", "Belgium", "Bulgaria", "Cyprus", "Czechia", "Germany",
115+ "Denmark", "Spain", "Estonia", "Finland", "France", "Greece",
116+ "Croatia", "Hungary", "Ireland","Italy", "Lithuania", "Luxembourg",
117+ "Latvia", "Malta", "Netherlands", "Poland", "Portugal",
118+ "Romania", "Slovakia", "Slovenia", "Sweden")
119+)
120+
121+
68122
69123 present_month <- month(today())
70124