This is a Readme document in Markdown format which was created within final course project of Cousera "Getting and Cleaning Data Course".
-
run_analysis.R as required by instructions and does all analyzes in changed order. The file also includes the self description of some parts of the process, so you can see most necessary description there. After you run this script, it should, also, save results of each 5 steps of the final task as csv format in ./data folder. Required final tidy dataset is stored as ./task_5_final_dataset.txt
-
Readme.md documents which describe each step of analyzes with a bit more details and results displayed. Also, this file allows run analyzes as the separate function for each data step with explanation of each step.
-
CodeBook.md which contains codebook of initially used data and codebook for each step of analyzes.
The order of steps neede to complete final task was changed and that was reflected by step numbes.
# Check and install necessary packages
cat("\014")
rm(list = ls())
if (!"dplyr" %in% installed.packages()) {install.packages("dplyr")}; library("dplyr")
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
if (!"tidyr" %in% installed.packages()) {install.packages("tidyr")}; library("tidyr")
if (!"janitor" %in% installed.packages()) {install.packages("janitor")}; library("janitor")
if (!"knitr" %in% installed.packages()) {install.packages("knitr")}; library("knitr")
# Import of required data
if(!file.exists("./data")){dir.create("./data")}
download.file("https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip", "./dataset.zip")
unzip("./dataset.zip")
# Import test data
X_test <- as_tibble(read.table("UCI HAR Dataset/test/X_test.txt", sep = "", stringsAsFactors= F))
Y_test <- as_tibble(read.table("UCI HAR Dataset/test/y_test.txt", sep = "", stringsAsFactors= F))
subject_test <- as_tibble(read.table("UCI HAR Dataset/test/subject_test.txt", sep = "", stringsAsFactors= F))
# Import train data
X_train <- as_tibble(read.table("UCI HAR Dataset/train/X_train.txt", sep = "", stringsAsFactors= F))
Y_train <- as_tibble(read.table("UCI HAR Dataset/train/y_train.txt", sep = "", stringsAsFactors= F))
subject_train <- as_tibble(read.table("UCI HAR Dataset/train/subject_train.txt", sep = "", stringsAsFactors= F))
# Join test and train data
test <- bind_cols(subject_test, Y_test, X_test)
train <- bind_cols(subject_train, Y_train, X_train)
joined_data <- ungroup(rbind(test, train))
# Write task_1_dataset.csv as results in csv
write.csv(joined_data, "./data/task_1_dataset.csv")
# Import file with column names and transpose
features <- as_tibble(read.table("UCI HAR Dataset/features.txt", sep = "", stringsAsFactors = F))
features_transposed <- as_tibble(t(c("subject_test", "exercise_mode", t(features[,2]))))
### Clean column names clean
colnames(joined_data) <- features_transposed
joined_data_cleaned <- clean_names(joined_data)
# Write task_4_dataset.csv as results in csv
write.csv(joined_data_cleaned, "./data/task_4_dataset.csv")
# Change numbers to activity names
activity_labels <- as_tibble(read.table("UCI HAR Dataset/activity_labels.txt", sep = "", stringsAsFactors = F))
i <- 0
while (i <= 6) {
joined_data_cleaned$exercise_mode[joined_data_cleaned$exercise_mode == as.character(i)] <- c(activity_labels[i,2])
i = i + 1
}
rm(i)
joined_data_cleaned$exercise_mode <- unlist(joined_data_cleaned$exercise_mode)
joined_data_cleaned <- as_tibble(joined_data_cleaned)
# Write task_3_dataset.csv as results in csv
write.csv(joined_data_cleaned, "./data/task_3_dataset.csv")
# Extract mean and std columns
joined_data_selected <- select(joined_data_cleaned, subject_test, exercise_mode, grep("mean", names(joined_data_cleaned)), grep("std", names(joined_data_cleaned)))
joined_data_selected$subject_test <- factor(joined_data_selected$subject_test)
joined_data_selected$exercise_mode <- factor(joined_data_selected$exercise_mode, levels = c("WALKING", "WALKING_UPSTAIRS", "WALKING_DOWNSTAIRS", "SITTING", "STANDING", "LAYING"))
# Write task_2_dataset.csv as results in csv
write.csv(joined_data_selected, "./data/task_2_dataset.csv")
5. From the data set in step 4, creates a second, independent tidy data set with the average of each variable for each activity and each subject.
# Group and summarize all with mean
joined_data_grouped <- group_by(joined_data_selected, subject_test, exercise_mode)
final_dataset <- summarize_all(joined_data_grouped, funs(mean))
# Write final dataset as results in csv
write.csv(final_dataset, "./data/task_5_final_dataset.csv")
write.table(final_dataset, "./task_5_final_dataset.txt")
str(final_dataset)
## Classes 'grouped_df', 'tbl_df', 'tbl' and 'data.frame': 180 obs. of 88 variables:
## $ subject_test : Factor w/ 30 levels "1","2","3","4",..: 1 1 1 1 1 1 2 2 2 2 ...
## $ exercise_mode : Factor w/ 6 levels "WALKING","WALKING_UPSTAIRS",..: 1 2 3 4 5 6 1 2 3 4 ...
## $ tbodyacc_mean_x : num 0.277 0.255 0.289 0.261 0.279 ...
## $ tbodyacc_mean_y : num -0.01738 -0.02395 -0.00992 -0.00131 -0.01614 ...
## $ tbodyacc_mean_z : num -0.1111 -0.0973 -0.1076 -0.1045 -0.1106 ...
## $ tgravityacc_mean_x : num 0.935 0.893 0.932 0.832 0.943 ...
## $ tgravityacc_mean_y : num -0.282 -0.362 -0.267 0.204 -0.273 ...
## $ tgravityacc_mean_z : num -0.0681 -0.0754 -0.0621 0.332 0.0135 ...
## $ tbodyaccjerk_mean_x : num 0.074 0.1014 0.0542 0.0775 0.0754 ...
## $ tbodyaccjerk_mean_y : num 0.028272 0.019486 0.02965 -0.000619 0.007976 ...
## $ tbodyaccjerk_mean_z : num -0.00417 -0.04556 -0.01097 -0.00337 -0.00369 ...
## $ tbodygyro_mean_x : num -0.0418 0.0505 -0.0351 -0.0454 -0.024 ...
## $ tbodygyro_mean_y : num -0.0695 -0.1662 -0.0909 -0.0919 -0.0594 ...
## $ tbodygyro_mean_z : num 0.0849 0.0584 0.0901 0.0629 0.0748 ...
## $ tbodygyrojerk_mean_x : num -0.09 -0.1222 -0.074 -0.0937 -0.0996 ...
## $ tbodygyrojerk_mean_y : num -0.0398 -0.0421 -0.044 -0.0402 -0.0441 ...
## $ tbodygyrojerk_mean_z : num -0.0461 -0.0407 -0.027 -0.0467 -0.049 ...
## $ tbodyaccmag_mean : num -0.137 -0.1299 0.0272 -0.9485 -0.9843 ...
## $ tgravityaccmag_mean : num -0.137 -0.1299 0.0272 -0.9485 -0.9843 ...
## $ tbodyaccjerkmag_mean : num -0.1414 -0.4665 -0.0894 -0.9874 -0.9924 ...
## $ tbodygyromag_mean : num -0.161 -0.1267 -0.0757 -0.9309 -0.9765 ...
## $ tbodygyrojerkmag_mean : num -0.299 -0.595 -0.295 -0.992 -0.995 ...
## $ fbodyacc_mean_x : num -0.2028 -0.4043 0.0382 -0.9796 -0.9952 ...
## $ fbodyacc_mean_y : num 0.08971 -0.19098 0.00155 -0.94408 -0.97707 ...
## $ fbodyacc_mean_z : num -0.332 -0.433 -0.226 -0.959 -0.985 ...
## $ fbodyacc_meanfreq_x : num -0.2075 -0.4187 -0.3074 -0.0495 0.0865 ...
## $ fbodyacc_meanfreq_y : num 0.1131 -0.1607 0.0632 0.0759 0.1175 ...
## $ fbodyacc_meanfreq_z : num 0.0497 -0.5201 0.2943 0.2388 0.2449 ...
## $ fbodyaccjerk_mean_x : num -0.1705 -0.4799 -0.0277 -0.9866 -0.9946 ...
## $ fbodyaccjerk_mean_y : num -0.0352 -0.4134 -0.1287 -0.9816 -0.9854 ...
## $ fbodyaccjerk_mean_z : num -0.469 -0.685 -0.288 -0.986 -0.991 ...
## $ fbodyaccjerk_meanfreq_x : num -0.209 -0.377 -0.253 0.257 0.314 ...
## $ fbodyaccjerk_meanfreq_y : num -0.3862 -0.5095 -0.3376 0.0475 0.0392 ...
## $ fbodyaccjerk_meanfreq_z : num -0.18553 -0.5511 0.00937 0.09239 0.13858 ...
## $ fbodygyro_mean_x : num -0.339 -0.493 -0.352 -0.976 -0.986 ...
## $ fbodygyro_mean_y : num -0.1031 -0.3195 -0.0557 -0.9758 -0.989 ...
## $ fbodygyro_mean_z : num -0.2559 -0.4536 -0.0319 -0.9513 -0.9808 ...
## $ fbodygyro_meanfreq_x : num 0.0148 -0.1875 -0.1005 0.1892 -0.1203 ...
## $ fbodygyro_meanfreq_y : num -0.0658 -0.4736 0.0826 0.0631 -0.0447 ...
## $ fbodygyro_meanfreq_z : num 0.000773 -0.133374 -0.075676 -0.029784 0.100608 ...
## $ fbodyaccmag_mean : num -0.1286 -0.3524 0.0966 -0.9478 -0.9854 ...
## $ fbodyaccmag_meanfreq : num 0.1906 -0.0977 0.1192 0.2367 0.2846 ...
## $ fbodybodyaccjerkmag_mean : num -0.0571 -0.4427 0.0262 -0.9853 -0.9925 ...
## $ fbodybodyaccjerkmag_meanfreq : num 0.0938 0.0854 0.0765 0.3519 0.4222 ...
## $ fbodybodygyromag_mean : num -0.199 -0.326 -0.186 -0.958 -0.985 ...
## $ fbodybodygyromag_meanfreq : num 0.268844 -0.219303 0.349614 -0.000262 -0.028606 ...
## $ fbodybodygyrojerkmag_mean : num -0.319 -0.635 -0.282 -0.99 -0.995 ...
## $ fbodybodygyrojerkmag_meanfreq : num 0.191 0.114 0.19 0.185 0.334 ...
## $ angle_tbodyaccmean_gravity : num 0.060454 0.096086 -0.002695 0.027442 -0.000222 ...
## $ angle_tbodyaccjerkmean_gravitymean : num -0.00793 -0.06108 0.08993 0.02971 0.02196 ...
## $ angle_tbodygyromean_gravitymean : num 0.0131 -0.1947 0.0633 0.0677 -0.0338 ...
## $ angle_tbodygyrojerkmean_gravitymean: num -0.0187 0.0657 -0.04 -0.0649 -0.0279 ...
## $ angle_x_gravitymean : num -0.729 -0.647 -0.744 -0.591 -0.743 ...
## $ angle_y_gravitymean : num 0.277 0.3348 0.2672 -0.0605 0.2702 ...
## $ angle_z_gravitymean : num 0.0689 0.0742 0.065 -0.218 0.0123 ...
## $ tbodyacc_std_x : num -0.284 -0.355 0.03 -0.977 -0.996 ...
## $ tbodyacc_std_y : num 0.11446 -0.00232 -0.03194 -0.92262 -0.97319 ...
## $ tbodyacc_std_z : num -0.26 -0.0195 -0.2304 -0.9396 -0.9798 ...
## $ tgravityacc_std_x : num -0.977 -0.956 -0.951 -0.968 -0.994 ...
## $ tgravityacc_std_y : num -0.971 -0.953 -0.937 -0.936 -0.981 ...
## $ tgravityacc_std_z : num -0.948 -0.912 -0.896 -0.949 -0.976 ...
## $ tbodyaccjerk_std_x : num -0.1136 -0.4468 -0.0123 -0.9864 -0.9946 ...
## $ tbodyaccjerk_std_y : num 0.067 -0.378 -0.102 -0.981 -0.986 ...
## $ tbodyaccjerk_std_z : num -0.503 -0.707 -0.346 -0.988 -0.992 ...
## $ tbodygyro_std_x : num -0.474 -0.545 -0.458 -0.977 -0.987 ...
## $ tbodygyro_std_y : num -0.05461 0.00411 -0.12635 -0.96647 -0.98773 ...
## $ tbodygyro_std_z : num -0.344 -0.507 -0.125 -0.941 -0.981 ...
## $ tbodygyrojerk_std_x : num -0.207 -0.615 -0.487 -0.992 -0.993 ...
## $ tbodygyrojerk_std_y : num -0.304 -0.602 -0.239 -0.99 -0.995 ...
## $ tbodygyrojerk_std_z : num -0.404 -0.606 -0.269 -0.988 -0.992 ...
## $ tbodyaccmag_std : num -0.2197 -0.325 0.0199 -0.9271 -0.9819 ...
## $ tgravityaccmag_std : num -0.2197 -0.325 0.0199 -0.9271 -0.9819 ...
## $ tbodyaccjerkmag_std : num -0.0745 -0.479 -0.0258 -0.9841 -0.9931 ...
## $ tbodygyromag_std : num -0.187 -0.149 -0.226 -0.935 -0.979 ...
## $ tbodygyrojerkmag_std : num -0.325 -0.649 -0.307 -0.988 -0.995 ...
## $ fbodyacc_std_x : num -0.3191 -0.3374 0.0243 -0.9764 -0.996 ...
## $ fbodyacc_std_y : num 0.056 0.0218 -0.113 -0.9173 -0.9723 ...
## $ fbodyacc_std_z : num -0.28 0.086 -0.298 -0.934 -0.978 ...
## $ fbodyaccjerk_std_x : num -0.1336 -0.4619 -0.0863 -0.9875 -0.9951 ...
## $ fbodyaccjerk_std_y : num 0.107 -0.382 -0.135 -0.983 -0.987 ...
## $ fbodyaccjerk_std_z : num -0.535 -0.726 -0.402 -0.988 -0.992 ...
## $ fbodygyro_std_x : num -0.517 -0.566 -0.495 -0.978 -0.987 ...
## $ fbodygyro_std_y : num -0.0335 0.1515 -0.1814 -0.9623 -0.9871 ...
## $ fbodygyro_std_z : num -0.437 -0.572 -0.238 -0.944 -0.982 ...
## $ fbodyaccmag_std : num -0.398 -0.416 -0.187 -0.928 -0.982 ...
## $ fbodybodyaccjerkmag_std : num -0.103 -0.533 -0.104 -0.982 -0.993 ...
## $ fbodybodygyromag_std : num -0.321 -0.183 -0.398 -0.932 -0.978 ...
## $ fbodybodygyrojerkmag_std : num -0.382 -0.694 -0.392 -0.987 -0.995 ...
## - attr(*, "vars")= chr "subject_test"
## - attr(*, "drop")= logi TRUE
kable(head(final_dataset), format = "markdown", padding = 0, caption = "Final dataset")
subject_test | exercise_mode | tbodyacc_mean_x | tbodyacc_mean_y | tbodyacc_mean_z | tgravityacc_mean_x | tgravityacc_mean_y | tgravityacc_mean_z | tbodyaccjerk_mean_x | tbodyaccjerk_mean_y | tbodyaccjerk_mean_z | tbodygyro_mean_x | tbodygyro_mean_y | tbodygyro_mean_z | tbodygyrojerk_mean_x | tbodygyrojerk_mean_y | tbodygyrojerk_mean_z | tbodyaccmag_mean | tgravityaccmag_mean | tbodyaccjerkmag_mean | tbodygyromag_mean | tbodygyrojerkmag_mean | fbodyacc_mean_x | fbodyacc_mean_y | fbodyacc_mean_z | fbodyacc_meanfreq_x | fbodyacc_meanfreq_y | fbodyacc_meanfreq_z | fbodyaccjerk_mean_x | fbodyaccjerk_mean_y | fbodyaccjerk_mean_z | fbodyaccjerk_meanfreq_x | fbodyaccjerk_meanfreq_y | fbodyaccjerk_meanfreq_z | fbodygyro_mean_x | fbodygyro_mean_y | fbodygyro_mean_z | fbodygyro_meanfreq_x | fbodygyro_meanfreq_y | fbodygyro_meanfreq_z | fbodyaccmag_mean | fbodyaccmag_meanfreq | fbodybodyaccjerkmag_mean | fbodybodyaccjerkmag_meanfreq | fbodybodygyromag_mean | fbodybodygyromag_meanfreq | fbodybodygyrojerkmag_mean | fbodybodygyrojerkmag_meanfreq | angle_tbodyaccmean_gravity | angle_tbodyaccjerkmean_gravitymean | angle_tbodygyromean_gravitymean | angle_tbodygyrojerkmean_gravitymean | angle_x_gravitymean | angle_y_gravitymean | angle_z_gravitymean | tbodyacc_std_x | tbodyacc_std_y | tbodyacc_std_z | tgravityacc_std_x | tgravityacc_std_y | tgravityacc_std_z | tbodyaccjerk_std_x | tbodyaccjerk_std_y | tbodyaccjerk_std_z | tbodygyro_std_x | tbodygyro_std_y | tbodygyro_std_z | tbodygyrojerk_std_x | tbodygyrojerk_std_y | tbodygyrojerk_std_z | tbodyaccmag_std | tgravityaccmag_std | tbodyaccjerkmag_std | tbodygyromag_std | tbodygyrojerkmag_std | fbodyacc_std_x | fbodyacc_std_y | fbodyacc_std_z | fbodyaccjerk_std_x | fbodyaccjerk_std_y | fbodyaccjerk_std_z | fbodygyro_std_x | fbodygyro_std_y | fbodygyro_std_z | fbodyaccmag_std | fbodybodyaccjerkmag_std | fbodybodygyromag_std | fbodybodygyrojerkmag_std |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | WALKING | 0.2773308 | -0.0173838 | -0.1111481 | 0.9352232 | -0.2821650 | -0.0681029 | 0.0740416 | 0.0282721 | -0.0041684 | -0.0418310 | -0.0695300 | 0.0849448 | -0.0899975 | -0.0398429 | -0.0461309 | -0.1369712 | -0.1369712 | -0.1414288 | -0.1609796 | -0.2987037 | -0.2027943 | 0.0897127 | -0.3315601 | -0.2075484 | 0.1130936 | 0.0497265 | -0.1705470 | -0.0352255 | -0.4689992 | -0.2092620 | -0.3862371 | -0.1855303 | -0.3390322 | -0.1030594 | -0.2559409 | 0.0147845 | -0.0657746 | 0.0007733 | -0.1286235 | 0.1906437 | -0.0571194 | 0.0938222 | -0.1992526 | 0.2688444 | -0.3193086 | 0.1906634 | 0.0604537 | -0.0079304 | 0.0130595 | -0.0187432 | -0.7292472 | 0.2769530 | 0.0688589 | -0.2837403 | 0.1144613 | -0.2600279 | -0.9766096 | -0.9713060 | -0.9477172 | -0.1136156 | 0.0670025 | -0.5026998 | -0.4735355 | -0.0546078 | -0.3442666 | -0.2074219 | -0.3044685 | -0.4042555 | -0.2196886 | -0.2196886 | -0.0744718 | -0.1869784 | -0.3253249 | -0.3191347 | 0.0560400 | -0.2796868 | -0.1335866 | 0.1067399 | -0.5347134 | -0.5166919 | -0.0335082 | -0.4365622 | -0.3980326 | -0.1034924 | -0.3210180 | -0.3816019 |
1 | WALKING_UPSTAIRS | 0.2554617 | -0.0239531 | -0.0973020 | 0.8933511 | -0.3621534 | -0.0754029 | 0.1013727 | 0.0194863 | -0.0455625 | 0.0505494 | -0.1661700 | 0.0583595 | -0.1222328 | -0.0421486 | -0.0407126 | -0.1299276 | -0.1299276 | -0.4665034 | -0.1267356 | -0.5948829 | -0.4043218 | -0.1909767 | -0.4333497 | -0.4187350 | -0.1606972 | -0.5201148 | -0.4798752 | -0.4134446 | -0.6854744 | -0.3770231 | -0.5094955 | -0.5511043 | -0.4926117 | -0.3194746 | -0.4535972 | -0.1874502 | -0.4735748 | -0.1333739 | -0.3523959 | -0.0977433 | -0.4426522 | 0.0853524 | -0.3259615 | -0.2193034 | -0.6346651 | 0.1142773 | 0.0960861 | -0.0610838 | -0.1947000 | 0.0656836 | -0.6471957 | 0.3347633 | 0.0741664 | -0.3547080 | -0.0023203 | -0.0194792 | -0.9563670 | -0.9528492 | -0.9123794 | -0.4468439 | -0.3782744 | -0.7065935 | -0.5448711 | 0.0041052 | -0.5071687 | -0.6147865 | -0.6016967 | -0.6063320 | -0.3249709 | -0.3249709 | -0.4789916 | -0.1486193 | -0.6485530 | -0.3374282 | 0.0217695 | 0.0859566 | -0.4619070 | -0.3817771 | -0.7260402 | -0.5658925 | 0.1515389 | -0.5717078 | -0.4162601 | -0.5330599 | -0.1829855 | -0.6939305 |
1 | WALKING_DOWNSTAIRS | 0.2891883 | -0.0099185 | -0.1075662 | 0.9318744 | -0.2666103 | -0.0621200 | 0.0541553 | 0.0296504 | -0.0109720 | -0.0350782 | -0.0909371 | 0.0900850 | -0.0739592 | -0.0439903 | -0.0270461 | 0.0271883 | 0.0271883 | -0.0894475 | -0.0757413 | -0.2954638 | 0.0382292 | 0.0015499 | -0.2255745 | -0.3073952 | 0.0632201 | 0.2943227 | -0.0276639 | -0.1286672 | -0.2883347 | -0.2531643 | -0.3375897 | 0.0093722 | -0.3524496 | -0.0557023 | -0.0318694 | -0.1004537 | 0.0825511 | -0.0756762 | 0.0965845 | 0.1191871 | 0.0262185 | 0.0764915 | -0.1857203 | 0.3496139 | -0.2819634 | 0.1900007 | -0.0026951 | 0.0899317 | 0.0633383 | -0.0399768 | -0.7444838 | 0.2672458 | 0.0650047 | 0.0300353 | -0.0319359 | -0.2304342 | -0.9505598 | -0.9370187 | -0.8959397 | -0.0122839 | -0.1016014 | -0.3457350 | -0.4580305 | -0.1263492 | -0.1247025 | -0.4870273 | -0.2388248 | -0.2687615 | 0.0198844 | 0.0198844 | -0.0257877 | -0.2257244 | -0.3065106 | 0.0243308 | -0.1129637 | -0.2979279 | -0.0863279 | -0.1345800 | -0.4017215 | -0.4954225 | -0.1814147 | -0.2384436 | -0.1865303 | -0.1040523 | -0.3983504 | -0.3919199 |
1 | SITTING | 0.2612376 | -0.0013083 | -0.1045442 | 0.8315099 | 0.2044116 | 0.3320437 | 0.0774825 | -0.0006191 | -0.0033678 | -0.0453501 | -0.0919242 | 0.0629314 | -0.0936794 | -0.0402118 | -0.0467026 | -0.9485368 | -0.9485368 | -0.9873642 | -0.9308925 | -0.9919763 | -0.9796412 | -0.9440846 | -0.9591849 | -0.0495136 | 0.0759461 | 0.2388299 | -0.9865970 | -0.9815795 | -0.9860531 | 0.2566108 | 0.0475438 | 0.0923920 | -0.9761615 | -0.9758386 | -0.9513155 | 0.1891530 | 0.0631271 | -0.0297839 | -0.9477829 | 0.2366550 | -0.9852621 | 0.3518522 | -0.9584356 | -0.0002622 | -0.9897975 | 0.1847759 | 0.0274415 | 0.0297098 | 0.0676981 | -0.0648816 | -0.5912475 | -0.0604660 | -0.2180172 | -0.9772290 | -0.9226186 | -0.9395863 | -0.9684571 | -0.9355171 | -0.9490409 | -0.9864307 | -0.9813720 | -0.9879108 | -0.9772113 | -0.9664739 | -0.9414259 | -0.9917316 | -0.9895181 | -0.9879358 | -0.9270784 | -0.9270784 | -0.9841200 | -0.9345318 | -0.9883087 | -0.9764123 | -0.9172750 | -0.9344696 | -0.9874930 | -0.9825139 | -0.9883392 | -0.9779042 | -0.9623450 | -0.9439178 | -0.9284448 | -0.9816062 | -0.9321984 | -0.9870496 |
1 | STANDING | 0.2789176 | -0.0161376 | -0.1106018 | 0.9429520 | -0.2729838 | 0.0134906 | 0.0753767 | 0.0079757 | -0.0036852 | -0.0239877 | -0.0593972 | 0.0748008 | -0.0996092 | -0.0440628 | -0.0489505 | -0.9842782 | -0.9842782 | -0.9923678 | -0.9764938 | -0.9949668 | -0.9952499 | -0.9770708 | -0.9852971 | 0.0865154 | 0.1174789 | 0.2448586 | -0.9946308 | -0.9854187 | -0.9907522 | 0.3141829 | 0.0391619 | 0.1385815 | -0.9863868 | -0.9889845 | -0.9807731 | -0.1202930 | -0.0447192 | 0.1006076 | -0.9853564 | 0.2845553 | -0.9925425 | 0.4222201 | -0.9846176 | -0.0286058 | -0.9948154 | 0.3344987 | -0.0002223 | 0.0219638 | -0.0337938 | -0.0279229 | -0.7434079 | 0.2701750 | 0.0122529 | -0.9957599 | -0.9731901 | -0.9797759 | -0.9937630 | -0.9812260 | -0.9763241 | -0.9946045 | -0.9856487 | -0.9922512 | -0.9871919 | -0.9877344 | -0.9806456 | -0.9929451 | -0.9951379 | -0.9921085 | -0.9819429 | -0.9819429 | -0.9930962 | -0.9786900 | -0.9947332 | -0.9960283 | -0.9722931 | -0.9779373 | -0.9950738 | -0.9870182 | -0.9923498 | -0.9874971 | -0.9871077 | -0.9823453 | -0.9823138 | -0.9925360 | -0.9784661 | -0.9946711 |
1 | LAYING | 0.2215982 | -0.0405140 | -0.1132036 | -0.2488818 | 0.7055498 | 0.4458177 | 0.0810865 | 0.0038382 | 0.0108342 | -0.0165531 | -0.0644861 | 0.1486894 | -0.1072709 | -0.0415173 | -0.0740501 | -0.8419292 | -0.8419292 | -0.9543963 | -0.8747595 | -0.9634610 | -0.9390991 | -0.8670652 | -0.8826669 | -0.1587927 | 0.0975348 | 0.0894377 | -0.9570739 | -0.9224626 | -0.9480609 | 0.1324191 | 0.0245136 | 0.0243879 | -0.8502492 | -0.9521915 | -0.9093027 | -0.0035468 | -0.0915291 | 0.0104581 | -0.8617676 | 0.0864086 | -0.9333004 | 0.2663912 | -0.8621902 | -0.1397750 | -0.9423669 | 0.1764859 | 0.0213660 | 0.0030604 | -0.0016670 | 0.0844372 | 0.4267062 | -0.5203438 | -0.3524131 | -0.9280565 | -0.8368274 | -0.8260614 | -0.8968300 | -0.9077200 | -0.8523663 | -0.9584821 | -0.9241493 | -0.9548551 | -0.8735439 | -0.9510904 | -0.9082847 | -0.9186085 | -0.9679072 | -0.9577902 | -0.7951449 | -0.7951449 | -0.9282456 | -0.8190102 | -0.9358410 | -0.9244374 | -0.8336256 | -0.8128916 | -0.9641607 | -0.9322179 | -0.9605870 | -0.8822965 | -0.9512320 | -0.9165825 | -0.7983009 | -0.9218040 | -0.8243194 | -0.9326607 |
kable(tail(final_dataset), format = "markdown", padding = 0, caption = "Final dataset")
subject_test | exercise_mode | tbodyacc_mean_x | tbodyacc_mean_y | tbodyacc_mean_z | tgravityacc_mean_x | tgravityacc_mean_y | tgravityacc_mean_z | tbodyaccjerk_mean_x | tbodyaccjerk_mean_y | tbodyaccjerk_mean_z | tbodygyro_mean_x | tbodygyro_mean_y | tbodygyro_mean_z | tbodygyrojerk_mean_x | tbodygyrojerk_mean_y | tbodygyrojerk_mean_z | tbodyaccmag_mean | tgravityaccmag_mean | tbodyaccjerkmag_mean | tbodygyromag_mean | tbodygyrojerkmag_mean | fbodyacc_mean_x | fbodyacc_mean_y | fbodyacc_mean_z | fbodyacc_meanfreq_x | fbodyacc_meanfreq_y | fbodyacc_meanfreq_z | fbodyaccjerk_mean_x | fbodyaccjerk_mean_y | fbodyaccjerk_mean_z | fbodyaccjerk_meanfreq_x | fbodyaccjerk_meanfreq_y | fbodyaccjerk_meanfreq_z | fbodygyro_mean_x | fbodygyro_mean_y | fbodygyro_mean_z | fbodygyro_meanfreq_x | fbodygyro_meanfreq_y | fbodygyro_meanfreq_z | fbodyaccmag_mean | fbodyaccmag_meanfreq | fbodybodyaccjerkmag_mean | fbodybodyaccjerkmag_meanfreq | fbodybodygyromag_mean | fbodybodygyromag_meanfreq | fbodybodygyrojerkmag_mean | fbodybodygyrojerkmag_meanfreq | angle_tbodyaccmean_gravity | angle_tbodyaccjerkmean_gravitymean | angle_tbodygyromean_gravitymean | angle_tbodygyrojerkmean_gravitymean | angle_x_gravitymean | angle_y_gravitymean | angle_z_gravitymean | tbodyacc_std_x | tbodyacc_std_y | tbodyacc_std_z | tgravityacc_std_x | tgravityacc_std_y | tgravityacc_std_z | tbodyaccjerk_std_x | tbodyaccjerk_std_y | tbodyaccjerk_std_z | tbodygyro_std_x | tbodygyro_std_y | tbodygyro_std_z | tbodygyrojerk_std_x | tbodygyrojerk_std_y | tbodygyrojerk_std_z | tbodyaccmag_std | tgravityaccmag_std | tbodyaccjerkmag_std | tbodygyromag_std | tbodygyrojerkmag_std | fbodyacc_std_x | fbodyacc_std_y | fbodyacc_std_z | fbodyaccjerk_std_x | fbodyaccjerk_std_y | fbodyaccjerk_std_z | fbodygyro_std_x | fbodygyro_std_y | fbodygyro_std_z | fbodyaccmag_std | fbodybodyaccjerkmag_std | fbodybodygyromag_std | fbodybodygyrojerkmag_std |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
30 | WALKING | 0.2764068 | -0.0175880 | -0.0986247 | 0.9652176 | -0.1576738 | -0.0039256 | 0.0688690 | 0.0219657 | -0.0073953 | -0.0459505 | -0.0649171 | 0.0839568 | -0.0873840 | -0.0617029 | -0.0446007 | -0.1951400 | -0.1951400 | -0.3521117 | -0.0229641 | -0.4720687 | -0.3514029 | -0.1938567 | -0.3095589 | -0.3463571 | 0.0306217 | -0.0837533 | -0.3895956 | -0.2995253 | -0.4670307 | -0.2688778 | -0.2748389 | -0.2012297 | -0.3744403 | -0.1759009 | -0.2473503 | -0.2076857 | -0.3807315 | -0.2626507 | -0.3423638 | 0.0483162 | -0.3471801 | 0.1150108 | -0.3583444 | -0.0688872 | -0.5476218 | 0.1023463 | 0.0530153 | -0.0152830 | 0.0157766 | -0.0720168 | -0.8613229 | 0.1916256 | 0.0244500 | -0.3463943 | -0.1735500 | -0.1204768 | -0.9797525 | -0.9701766 | -0.9439584 | -0.3744009 | -0.2707093 | -0.5213519 | -0.3879206 | 0.0060028 | -0.1825697 | -0.4603454 | -0.4976218 | -0.4762088 | -0.3598734 | -0.3598734 | -0.3537510 | -0.2668457 | -0.5469773 | -0.3449281 | -0.2156343 | -0.0931448 | -0.4151354 | -0.2894661 | -0.5754103 | -0.3990323 | 0.0955456 | -0.2379415 | -0.4698528 | -0.3665374 | -0.3315417 | -0.5785800 |
30 | WALKING_UPSTAIRS | 0.2714156 | -0.0253312 | -0.1246975 | 0.9318298 | -0.2266473 | -0.0221401 | 0.0579840 | -0.0035872 | 0.0161506 | -0.0035597 | -0.0779606 | 0.0814699 | -0.1084143 | -0.0141113 | -0.0364158 | -0.1376279 | -0.1376279 | -0.5966001 | -0.1136084 | -0.7187803 | -0.4204028 | -0.2978138 | -0.3675198 | -0.5902615 | -0.3338217 | -0.5122484 | -0.5506784 | -0.5929194 | -0.7378039 | -0.4436963 | -0.5367438 | -0.6261676 | -0.4880390 | -0.3660584 | -0.3189370 | -0.3369542 | -0.6427040 | -0.4836833 | -0.4005884 | -0.3123380 | -0.5497849 | -0.0484763 | -0.4491507 | -0.4566387 | -0.7739745 | -0.0714399 | -0.0001802 | 0.0868940 | -0.0362012 | 0.0174889 | -0.7901143 | 0.2409754 | 0.0373907 | -0.3505045 | -0.1273112 | 0.0249468 | -0.9540336 | -0.9149339 | -0.8624028 | -0.5354202 | -0.5872145 | -0.7619420 | -0.4938375 | -0.0840482 | -0.2115736 | -0.7427495 | -0.7433370 | -0.6651506 | -0.3274108 | -0.3274108 | -0.5618377 | -0.1692935 | -0.7744391 | -0.3262604 | -0.1042992 | 0.1214474 | -0.5615652 | -0.6108266 | -0.7847539 | -0.5034842 | 0.0449546 | -0.2534271 | -0.3945081 | -0.5808781 | -0.1514723 | -0.7913494 |
30 | WALKING_DOWNSTAIRS | 0.2831906 | -0.0174384 | -0.0999781 | 0.9580005 | -0.1267104 | 0.0288082 | 0.0883933 | -0.0075611 | -0.0118301 | -0.0745591 | -0.0693112 | 0.0895768 | -0.0615955 | -0.0496808 | -0.0543595 | -0.0373901 | -0.0373901 | -0.2937388 | -0.0955373 | -0.5743370 | -0.1069670 | -0.0216637 | -0.2580674 | -0.4633029 | -0.0640946 | 0.0428810 | -0.2349231 | -0.2249928 | -0.3996887 | -0.3071167 | -0.4250517 | -0.1683407 | -0.2630616 | -0.3480651 | -0.2637208 | -0.3957702 | -0.2864671 | -0.2527629 | 0.0041015 | -0.0724828 | -0.1259614 | -0.1252104 | -0.3567723 | -0.1759313 | -0.6175788 | 0.0227158 | 0.0065700 | -0.0615355 | 0.0811338 | -0.1089736 | -0.8831362 | 0.1709113 | 0.0013913 | -0.0577703 | -0.0272628 | -0.2172757 | -0.9588904 | -0.9186788 | -0.8776671 | -0.2266439 | -0.1946561 | -0.4670702 | -0.2659232 | -0.2853924 | -0.2953704 | -0.5427645 | -0.6137963 | -0.4988829 | -0.0135771 | -0.0135771 | -0.1252832 | -0.2082675 | -0.6176621 | -0.0405257 | -0.0934683 | -0.2573934 | -0.2898027 | -0.2174320 | -0.5355150 | -0.2783866 | -0.2557321 | -0.3715415 | -0.1785352 | -0.1331243 | -0.2523619 | -0.6455039 |
30 | SITTING | 0.2683361 | -0.0080473 | -0.0995154 | 0.8254738 | 0.1145884 | 0.3447660 | 0.0760058 | 0.0097569 | -0.0027816 | -0.0358426 | -0.0743536 | 0.0702003 | -0.0952708 | -0.0407931 | -0.0488205 | -0.9574872 | -0.9574872 | -0.9877991 | -0.9558473 | -0.9937374 | -0.9850088 | -0.9540760 | -0.9662741 | -0.1227005 | 0.0071382 | 0.0927750 | -0.9887754 | -0.9804057 | -0.9859783 | 0.1366891 | -0.1277838 | -0.0214875 | -0.9870346 | -0.9820059 | -0.9611771 | -0.0154022 | -0.3127816 | -0.0503841 | -0.9599234 | 0.0705937 | -0.9858263 | 0.3187685 | -0.9738763 | -0.1466085 | -0.9917507 | 0.2166511 | -0.0151925 | 0.0458754 | -0.0075999 | -0.0208555 | -0.5963054 | 0.0010395 | -0.2275346 | -0.9836227 | -0.9378570 | -0.9506540 | -0.9783647 | -0.9593613 | -0.9566357 | -0.9888646 | -0.9804209 | -0.9881644 | -0.9881327 | -0.9764776 | -0.9550532 | -0.9938685 | -0.9924913 | -0.9881245 | -0.9429015 | -0.9429015 | -0.9860576 | -0.9606413 | -0.9912802 | -0.9832310 | -0.9339926 | -0.9462038 | -0.9900176 | -0.9819021 | -0.9889712 | -0.9884848 | -0.9738050 | -0.9573087 | -0.9435437 | -0.9852950 | -0.9595139 | -0.9909464 |
30 | STANDING | 0.2771127 | -0.0170164 | -0.1087562 | 0.9685567 | -0.1002968 | 0.0243044 | 0.0752414 | 0.0120860 | 0.0019084 | -0.0276139 | -0.0670334 | 0.0802515 | -0.0997160 | -0.0437760 | -0.0520307 | -0.9305736 | -0.9305736 | -0.9712252 | -0.9138906 | -0.9729953 | -0.9720141 | -0.9194751 | -0.9380898 | -0.0532792 | -0.2378598 | -0.0288534 | -0.9678576 | -0.9574349 | -0.9628926 | 0.0608341 | -0.2659804 | -0.0606642 | -0.9157429 | -0.9456288 | -0.9377981 | -0.3935262 | -0.3023487 | -0.2486312 | -0.9320475 | -0.1115002 | -0.9533576 | 0.0494753 | -0.9174494 | -0.3183091 | -0.9592422 | -0.1317205 | 0.0172814 | 0.0041669 | 0.0515531 | 0.0328842 | -0.8781591 | 0.1522859 | 0.0046999 | -0.9775594 | -0.8916545 | -0.9128506 | -0.9964209 | -0.9581458 | -0.9492074 | -0.9684307 | -0.9573189 | -0.9688973 | -0.9114085 | -0.9407054 | -0.9308347 | -0.9601191 | -0.9681350 | -0.9708457 | -0.9165704 | -0.9165704 | -0.9507623 | -0.8872476 | -0.9559957 | -0.9804266 | -0.8855728 | -0.9072868 | -0.9722167 | -0.9604424 | -0.9739543 | -0.9117182 | -0.9394698 | -0.9351769 | -0.9217332 | -0.9466398 | -0.8888722 | -0.9550086 |
30 | LAYING | 0.2810339 | -0.0194494 | -0.1036582 | -0.3447378 | 0.7326612 | 0.6814592 | 0.0752197 | 0.0107680 | -0.0003742 | -0.0267812 | -0.0761476 | 0.0938472 | -0.1022774 | -0.0384876 | -0.0595737 | -0.9698300 | -0.9698300 | -0.9792328 | -0.9622849 | -0.9850864 | -0.9747900 | -0.9599743 | -0.9703220 | -0.2229584 | 0.0705691 | 0.2302698 | -0.9768879 | -0.9716963 | -0.9756324 | 0.0410382 | -0.1419612 | 0.0650537 | -0.9717891 | -0.9681703 | -0.9675774 | -0.0661794 | -0.2399248 | 0.0674681 | -0.9628408 | 0.1760172 | -0.9699493 | 0.1721211 | -0.9620012 | -0.0802049 | -0.9778213 | 0.1072526 | -0.0106131 | 0.0369006 | 0.0372059 | 0.0173555 | 0.4998487 | -0.4922870 | -0.5070199 | -0.9763625 | -0.9542018 | -0.9670442 | -0.9795639 | -0.9889307 | -0.9832745 | -0.9774638 | -0.9710498 | -0.9795179 | -0.9736628 | -0.9660417 | -0.9688892 | -0.9837758 | -0.9803571 | -0.9807689 | -0.9601679 | -0.9601679 | -0.9696423 | -0.9512644 | -0.9761771 | -0.9770453 | -0.9535584 | -0.9671882 | -0.9803507 | -0.9724342 | -0.9822816 | -0.9744884 | -0.9651342 | -0.9721992 | -0.9640518 | -0.9680878 | -0.9526444 | -0.9754815 |