Spaces:
Sleeping
Sleeping
Update process_data.R
Browse files- process_data.R +1 -21
process_data.R
CHANGED
|
@@ -234,21 +234,6 @@ clean_and_convert <- function(cell) {
|
|
| 234 |
})
|
| 235 |
}
|
| 236 |
# Load the trust driver dataset (CSV or Excel)
|
| 237 |
-
|
| 238 |
-
clean_and_convert <- function(cell) {
|
| 239 |
-
if (is.character(cell)) {
|
| 240 |
-
cell <- gsub("\t", "", cell)
|
| 241 |
-
}
|
| 242 |
-
tryCatch({
|
| 243 |
-
as.numeric(cell)
|
| 244 |
-
}, warning = function(w) {
|
| 245 |
-
cell
|
| 246 |
-
}, error = function(e) {
|
| 247 |
-
cell
|
| 248 |
-
})
|
| 249 |
-
}
|
| 250 |
-
|
| 251 |
-
|
| 252 |
|
| 253 |
|
| 254 |
data_driver <- NULL
|
|
@@ -256,12 +241,7 @@ if (grepl(".xlsx", input_file)) {
|
|
| 256 |
# Load the Excel file with the fourth row as the header
|
| 257 |
data_driver <- read_excel(input_file, sheet = "Driver", skip = 3)
|
| 258 |
|
| 259 |
-
|
| 260 |
-
data_driver[] <- lapply(data_driver, function(col) sapply(col, clean_and_convert))
|
| 261 |
-
} else {
|
| 262 |
-
stop("Input file must be an Excel file (.xlsx)")
|
| 263 |
-
}
|
| 264 |
-
return(data_driver)
|
| 265 |
}
|
| 266 |
# Process the Trust model
|
| 267 |
trust_driver_analysis(
|
|
|
|
| 234 |
})
|
| 235 |
}
|
| 236 |
# Load the trust driver dataset (CSV or Excel)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
|
| 238 |
|
| 239 |
data_driver <- NULL
|
|
|
|
| 241 |
# Load the Excel file with the fourth row as the header
|
| 242 |
data_driver <- read_excel(input_file, sheet = "Driver", skip = 3)
|
| 243 |
|
| 244 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
}
|
| 246 |
# Process the Trust model
|
| 247 |
trust_driver_analysis(
|