R/CleanCSV.R

Defines functions CleanCSV

Documented in CleanCSV

CleanCSV =
    function(file) {
      if (interactive()) {
        for (ThisFile in file) {
          cat(paste0(ThisFile, ": "))
          if (file.exists(ThisFile)) {
            file.copy(ThisFile, paste0(ThisFile, ".bak"))
            for (FixString in c(", ", " ,", "\t,", ",\t")) {
              FindReplace(ThisFile, FixString, ",")
            }
            .Done() 
          }  # end ThisFile exists condition
              else {
            .FileDoesNotExist()
          }
        }  # end for loop for files
      }  # end interactive ondition
          else {
        .InteractiveOnly()
      }
      return(invisible(NULL))
    }

Try the BrailleR package in your browser

Any scripts or data that you put into this service are public.

BrailleR documentation built on July 26, 2023, 5:46 p.m.