Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 10.10 Changes #5

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 28 additions & 29 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
Package: correspondenceTables
Type: Package
Title: Creating Correspondence Tables Between Two Statistical Classifications
Date: 2022-09-30
Version: 0.9.9
Authors@R: c(person("Vasilis", "Chasiotis", role = "aut", comment="Department of Statistics, Athens University of Economics and Business"),
person("Photis", "Stavropoulos", role = "aut", comment="Quantos S.A. Statistics and Information Systems"),
person("Martin", "Karlberg", role = "aut"),
person("Mátyás", "Mészáros", email = "[email protected]", role = "cre"),
person("Martina", "Patone", role = "aut"),
person("Erkand", "Muraku", role = "aut"),
person("Clement", "Thomas", role = "aut"),
person("Loic", "Bienvenu", role = "aut"))
Description:
A candidate correspondence table between two classifications can be created when there are correspondence tables leading from the first classification to the second one via intermediate 'pivot' classifications.
The correspondence table between two statistical classifications can be updated when one of the classifications gets updated to a new version.
License: EUPL
Encoding: UTF-8
Imports: data.table, httr, tidyverse, writexl, stringr, igraph, tools
Suggests:
knitr,
rmarkdown,
tinytest
VignetteBuilder: knitr
NeedsCompilation: no
URL: https://github.com/eurostat/correspondenceTables
BugReports: https://github.com/eurostat/correspondenceTables/issues
Maintainer: Mátyás Mészáros <[email protected]>
RoxygenNote: 7.2.3
Package: correspondenceTables
Type: Package
Title: Creating Correspondence Tables Between Two Statistical Classifications
Date: 2022-09-30
Version: 0.10.10
Authors@R: c(person("Vasilis", "Chasiotis", role = "aut", comment="Department of Statistics, Athens University of Economics and Business"),
person("Photis", "Stavropoulos", role = "aut", comment="Quantos S.A. Statistics and Information Systems"),
person("Martin", "Karlberg", role = "aut"),
person("Mátyás", "Mészáros", email = "[email protected]", role = "cre"),
person("Martina", "Patone", role = "aut"),
person("Erkand", "Muraku", role = "aut"),
person("Clement", "Thomas", role = "aut"),
person("Loic", "Bienvenu", role = "aut"))
Description:
A candidate correspondence table between two classifications can be created when there are correspondence tables leading from the first classification to the second one via intermediate 'pivot' classifications.
The correspondence table between two statistical classifications can be updated when one of the classifications gets updated to a new version.
License: EUPL
Encoding: UTF-8
Imports: data.table, httr, stringr, igraph, tools
Suggests:
knitr,
rmarkdown, tinytest
VignetteBuilder: knitr
NeedsCompilation: no
URL: https://github.com/eurostat/correspondenceTables
BugReports: https://github.com/eurostat/correspondenceTables/issues
Maintainer: Mátyás Mészáros <[email protected]>
RoxygenNote: 7.2.3
16 changes: 16 additions & 0 deletions R/Check_n_columns.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
check_n_columns <- function(df, source, num_columns) {
caller <- sys.call(-1) #define the caller function
tryCatch({
if (ncol(df) < num_columns) {
stop(paste("In",as.character(caller[1]), ", the data", source, " has less than the minimum required ", num_columns, "columns."))
} else if (ncol(df) > num_columns) {
warning(paste("In", as.character(caller[1]),", the data", source, " has more than", num_columns, "columns."))
} else {
#print(paste("The data", source, " has exactly", num_columns, "columns."))
}
}, error = function(e) {
print(paste("Error:", e$message))
}, warning = function(e) {
print(paste("Warning:", e$message))
})
}
31 changes: 31 additions & 0 deletions R/CsvFileSave.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CsvFileSave <- function(CSVpath, OutputDF) {
if (!is.null(CSVpath)) {

# Check if the file exists and prompt for overwrite confirmation
if (file.exists(CSVpath)) {
cat("A CSV file with the same name already exists.\n")
cat("Warning: This action will overwrite the existing file.\n")

proceed <- ""
while (!(proceed %in% c("y", "n"))) {
proceed <- tolower(readline("Do you want to proceed? (y/n): "))
if (!(proceed %in% c("y", "n"))) {
cat("Invalid input. Please enter 'y' or 'n'.\n")
}
}

if (proceed != "y") {
cat("Operation aborted.\n")
return(NULL)
}
}
# Try to write the CSV file with error handling
tryCatch({
write.csv(OutputDF, CSVpath, row.names = FALSE)
cat("The table was saved in", CSVpath, "\n")
}, error = function(e) {
cat("An error occurred while writing to the file:\n")
cat(e$message, "\n")
})
}
}
Loading