- Download UCI HAR Dataset to project directory
- Open R console and set working directory to project directory
- Load script with:
source('run_analysis.R')
- Run script with:
run_analysis()
- Script writes data from step 4 to
data.txt
and data form step 5 tosummary.txt
- Load output data with
read.table
, for example:data <- read.table("data.txt")
run_analysis.R
checks ifUCI HAR Dataset
directory exists. If yes, it loads files from it, otherwise tries to load files from current directory.- Loads
features.txt
to use it as column names forX_train.txt
andX_test.txt
. - After loading
X_train.txt
andX_test.txt
columns which names contains.mean.
or.std.
are extracted. y_train.txt
andy_test.txt
are matched with labels fromactivity_labels.txt
and loaded toactivity
column.subject_train.txt
andsubject_test.txt
are loaded tosubject
column.- File
data.txt
with current dataset is saved. - File
summary.txt
with mean value for each variable for each activity and subject is saved.