Spaces:
Running
Running
Update app.R
Browse files
app.R
CHANGED
|
@@ -498,37 +498,46 @@ server <- function(input, output, session) {
|
|
| 498 |
})
|
| 499 |
|
| 500 |
# Processing summary
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
}
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
removed_cols <- intersect(selected_cols_to_remove, names(original_df))
|
| 514 |
-
|
| 515 |
-
summary_text <- paste(
|
| 516 |
-
"β File processed successfully!",
|
| 517 |
-
paste("β Original columns:", ncol(original_df)),
|
| 518 |
-
paste("β Final columns:", ncol(df)),
|
| 519 |
-
paste("β Target columns: 167"),
|
| 520 |
-
paste("β Rows processed:", nrow(df)),
|
| 521 |
-
paste("β Removed columns:", length(removed_cols)),
|
| 522 |
-
if (length(removed_cols) > 0) paste(" -", paste(head(removed_cols, 5), collapse = ", "),
|
| 523 |
-
if (length(removed_cols) > 5) "..." else ""),
|
| 524 |
-
"β Duplicates removed",
|
| 525 |
-
paste("β Ready for further processing"),
|
| 526 |
-
sep = "\n"
|
| 527 |
-
)
|
| 528 |
-
|
| 529 |
-
return(summary_text)
|
| 530 |
-
})
|
| 531 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 532 |
# Preview table
|
| 533 |
output$preview <- DT::renderDataTable({
|
| 534 |
req(processed_data())
|
|
|
|
| 498 |
})
|
| 499 |
|
| 500 |
# Processing summary
|
| 501 |
+
output$process_summary <- renderText({
|
| 502 |
+
if (is.null(input$file)) {
|
| 503 |
+
return("No file uploaded yet.")
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
if (is.null(processed_data())) {
|
| 507 |
+
return("Processing...")
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
df <- processed_data()
|
| 511 |
+
original_df <- read.csv(input$file$datapath, nrows = 1)
|
| 512 |
+
selected_cols_to_remove <- input$columns_to_remove %||% character(0)
|
| 513 |
+
removed_cols <- intersect(selected_cols_to_remove, names(original_df))
|
| 514 |
+
|
| 515 |
+
# Build the removed columns text
|
| 516 |
+
removed_cols_text <- if (length(removed_cols) > 0) {
|
| 517 |
+
cols_display <- if (length(removed_cols) > 5) {
|
| 518 |
+
paste(paste(head(removed_cols, 5), collapse = ", "), "...")
|
| 519 |
+
} else {
|
| 520 |
+
paste(removed_cols, collapse = ", ")
|
| 521 |
}
|
| 522 |
+
paste("β Removed columns:", length(removed_cols), "\n -", cols_display)
|
| 523 |
+
} else {
|
| 524 |
+
"β Removed columns: 0"
|
| 525 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 526 |
|
| 527 |
+
summary_text <- paste(
|
| 528 |
+
"β File processed successfully!",
|
| 529 |
+
paste("β Original columns:", ncol(original_df)),
|
| 530 |
+
paste("β Final columns:", ncol(df)),
|
| 531 |
+
paste("β Target columns: 167"),
|
| 532 |
+
paste("β Rows processed:", nrow(df)),
|
| 533 |
+
removed_cols_text,
|
| 534 |
+
"β Duplicates removed",
|
| 535 |
+
paste("β Ready for further processing"),
|
| 536 |
+
sep = "\n"
|
| 537 |
+
)
|
| 538 |
+
|
| 539 |
+
return(summary_text)
|
| 540 |
+
})
|
| 541 |
# Preview table
|
| 542 |
output$preview <- DT::renderDataTable({
|
| 543 |
req(processed_data())
|