This repo contains the run_analysis.R script, which is part of the Peer Review Programming Assignment for coursera course Getting and Cleaning Data by Prof. Jeff Leak. The script takes single input argument, "working directory". The working directory is where the data files are present. So for e.g. if the data files are located at
Murtuzas-Mac-mini:UCI HAR Dataset murtuza$ pwd
/Users/murtuza/coursera/gettingdata/project/UCI HAR Dataset
Murtuzas-Mac-mini:UCI HAR Dataset murtuza$ ls
README.txt features.txt result.txt test
activity_labels.txt features_info.txt run_analysis.R train
The script should be called as run_analysis("/Users/murtuza/coursera/gettingdata/project/UCI\ HAR\ Dataset")
Alternatively, from the R console one can also do
setwd("/Users/murtuza/coursera/gettingdata/project/UCI\ HAR\ Dataset")
run_analysis(getwd())
The output of the script is the cleaned up dataset as required by the assignment. The script returns the data.frame object of the tidy dataset, so if you don't want your console to be filled with data after the script is called, you can store the result in a variable, as shown below
tidyDataset <- run_analysis("/Users/murtuza/coursera/gettingdata/project/UCI\ HAR\ Dataset")
Now tidyDataset has the cleaned up data.frame object.