Sample Data

The package installs two sample files: study_data.xlsx and study_data_messy.xlsx

The following code can be copied and run to view the first file:

tidy_data <- "study_data.xlsx"
messy_data <- "study_data_messy.xlsx"

file_path <- system.file("extdata", tidy_data, package = "importExcel")

# Check if the file exists
if (file.exists(file_path)) {
  # Open the file using the default system application (Excel)
  
  # For Windows
  if (Sys.info()['sysname'] == "Windows") {
    shell.exec(file_path)
  }
  
  # For macOS
  else if (Sys.info()['sysname'] == "Darwin") {
    system(paste("open", shQuote(file_path)))
  }
  
  # For Linux
  else if (Sys.info()['sysname'] == "Linux") {
    system(paste("xdg-open", shQuote(file_path)))
  }
  
  # If the OS is not recognized
  else {
    message("Unable to open file: Unrecognized operating system")
  }
} else {
  message("File  not found in the package's inst/extdata directory")
}