Skip to content

Instantly share code, notes, and snippets.

@munroebot
Created April 26, 2015 14:56
Show Gist options
  • Save munroebot/09add51aabc095c4455a to your computer and use it in GitHub Desktop.
Save munroebot/09add51aabc095c4455a to your computer and use it in GitHub Desktop.
File Test for assignment
#
# First make sure the datasets are available
#
if (!file.exists(file.path(getwd(),"UCI HAR Dataset/test/X2_test.txt")) |
!file.exists(file.path(getwd(),"UCI HAR Dataset/test/y_test.txt")) |
!file.exists(file.path(getwd(),"UCI HAR Dataset/test/subject_test.txt")) |
!file.exists(file.path(getwd(),"UCI HAR Dataset/train/X_train.txt")) |
!file.exists(file.path(getwd(),"UCI HAR Dataset/train/y_train.txt")) |
!file.exists(file.path(getwd(),"UCI HAR Dataset/train/subject_train.txt"))) {
print("Unable to load the complete dataset")
print("Please download the data from:")
print("https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip")
print("and unzip it into your working directory")
stop("Script halted")
}
#
# Load the test and training datasets
#
acc_data_test <- read.table(file.path(getwd(),"UCI HAR Dataset/test/X_test.txt"))
act_data_test <- read.table(file.path(getwd(),"UCI HAR Dataset/test/y_test.txt"))
sub_data_test <- read.table(file.path(getwd(),"UCI HAR Dataset/test/subject_test.txt"))
acc_data_train <- read.table(file.path(getwd(),"UCI HAR Dataset/train/X_train.txt"))
act_data_train <- read.table(file.path(getwd(),"UCI HAR Dataset/train/y_train.txt"))
sub_data_train <- read.table(file.path(getwd(),"UCI HAR Dataset/train/subject_train.txt"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment