library(ucihar)

data("ucihar")
data("ucihar_avgs")

num_ucihar_rows <- nrow(ucihar)
num_ucihar_cols <- ncol(ucihar)
num_ucihar_avgs_rows <- nrow(ucihar_avgs)
num_ucihar_avgs_cols <- ncol(ucihar_avgs)

The original data set is available at the UCI Machine Learning Repository as the Human Activity Recognition Using Smartphones Data Set (data folder). Full details are available in the README.txt in the download archive or on the web at UCI HAR Dataset.names file. This package contains two tidy data sets:

  1. ucihar -- mean and standard deviation measurements (r num_ucihar_rows obs. of r num_ucihar_cols variables)
  2. ucihar_avgs -- summarized (mean) values for each measurement in ucihar by subject and activity (r num_ucihar_avgs_rows obs. of r num_ucihar_avgs_cols variables)

Study Design

The source data is across multiple files. The following are the steps taken to create the ucihar data set:

The following are the steps taken to clean field and activity labels:

The following are the steps taken to create the ucihar_avgs data set:

Implementations for both data sets are in get_ucihar() and get_ucihar_avgs() in data-raw/run_analysis.R.

Code book for the ucihar data set

The following maps variables from the source details document to the new variable names:

subject_id : Subject identifier

activity : Type of activity being performed (r unique(ucihar$activity))

time_body_acc_{mean,std}_{x,y,z}, time_body_acc_mag_{mean,std}, time_body_acc_jerk_{mean,std}_{x,y,z}, time_body_acc_jerk_mag_{mean,std} : Mean and standard deviation body acceleration, in time domain; units are g's; ref. tBodyAcc-XYZ, tBodyAccMag, tBodyAccJerk-XYZ, tBodyAccJerkMag-XYZ

time_body_gyro_{mean,std}_{x,y,z}, time_body_gyro_mag_{mean,std}, time_body_gyro_jerk_{mean,std}_{x,y,z}, time_body_gyro_jerk_mag_{mean,std} : Mean and standard deviation body angulary velocity, in time domain; units are rad/seg; ref. tBodyGyro-XYZ, tBodyGyroMag, tBodyGyroJerk-XYZ, tBodyGyroJerkMag-XYZ

time_gravity_acc_{mean,std}_{x,y,z}, time_gravity_acc_mag_{mean,std} : Mean and standard deviation gravity in x, y, and z directions, in time domain; units are g's; ref. tGravityAcc-XYZ, tGravityAccMag

freq_body_acc_{mean,std}_{x,y,z}, freq_body_acc_mag_{mean,std}, freq_body_acc_jerk_{mean,std}_{x,y,z}, freq_body_body_acc_jerk_mag_{mean,std} : Mean and standard deviation body acceleration, in frequency domain; units are g's; ref. fBodyAcc-XYZ, fBodyAccMag, fBodyAccJerk-XYZ, fBodyBodyAccJerkMag

freq_body_gyro_{mean,std}_{x,y,z}, freq_body_body_gyro_mag_{mean,std}, freq_body_body_gyro_jerk_mag_{mean,std} : Mean and standard deviation body angulary velocity, in frequency domain; units are rad/seg; ref. fBodyGyro-XYZ, fBodyBodyGyroMag, fBodyBodyGyroJerkMag

Code book for the ucihar_avgs data set

This data set summarizes measurements from ucihar, grouped by subject and activity. In all cases, the measurements are averaged with mean(). See the above ucihar code book (above) for more details.

subject_id : Subject identifier

activity : Type of activity being performed (r unique(ucihar$activity))

time_body_acc_{mean,std}_{x,y,z}, time_body_acc_mag_{mean,std}, time_body_acc_jerk_{mean,std}_{x,y,z}, time_body_acc_jerk_mag_{mean,std} : Mean by subject_id and activity

time_body_gyro_{mean,std}_{x,y,z}, time_body_gyro_mag_{mean,std}, time_body_gyro_jerk_{mean,std}_{x,y,z}, time_body_gyro_jerk_mag_{mean,std} : Mean by subject_id and activity

time_gravity_acc_{mean,std}_{x,y,z}, time_gravity_acc_mag_{mean,std} : Mean by subject_id and activity

freq_body_acc_{mean,std}_{x,y,z}, freq_body_acc_mag_{mean,std}, freq_body_acc_jerk_{mean,std}_{x,y,z}, freq_body_body_acc_jerk_mag_{mean,std} : Mean by subject_id and activity

freq_body_gyro_{mean,std}_{x,y,z}, freq_body_body_gyro_mag_{mean,std}, freq_body_body_gyro_jerk_mag_{mean,std} : Mean by subject_id and activity



dylan-stark/ucihar documentation built on May 15, 2019, 7:23 p.m.