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:
ucihar
-- mean and standard deviation measurements (r num_ucihar_rows
obs. of r num_ucihar_cols
variables)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)The source data is across multiple files.
The following are the steps taken to create the ucihar
data set:
features.txt
test/X_test.txt
, using feature names as column names, adding activity IDs from test/y_test.txt
, and adding subject IDs from test/subject_test.txt
.activity_labels.txt
The following are the steps taken to clean field and activity labels:
_
instead of camelCase, recode f
and t
to freq
and time
, remove non-alphanumeric characteris (
, )
, and -
(e.g., from tBodyAcc-mean()-X
to time_body_acc_mean_x
)WALKING_UPSTAIRS
to walking_upstairs
)The following are the steps taken to create the ucihar_avgs
data set:
ucihar
data by subject_id
and activity
mean()
Implementations for both data sets are in get_ucihar()
and get_ucihar_avgs()
in data-raw/run_analysis.R
.
ucihar
data setThe 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
ucihar_avgs
data setThis 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.