{"action":"closed","number":1,"pull_request":{"url":"https://api.github.com/repos/zjamshed/-run_analysis.R/pulls/1","id":43130596,"html_url":"https://github.com/zjamshed/-run_analysis.R/pull/1","diff_url":"https://github.com/zjamshed/-run_analysis.R/pull/1.diff","patch_url":"https://github.com/zjamshed/-run_analysis.R/pull/1.patch","issue_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/issues/1","number":1,"state":"closed","locked":false,"title":"Update README.md","user":{"login":"zjamshed","id":11840674,"avatar_url":"https://avatars.githubusercontent.com/u/11840674?v=3","gravatar_id":"","url":"https://api.github.com/users/zjamshed","html_url":"https://github.com/zjamshed","followers_url":"https://api.github.com/users/zjamshed/followers","following_url":"https://api.github.com/users/zjamshed/following{/other_user}","gists_url":"https://api.github.com/users/zjamshed/gists{/gist_id}","starred_url":"https://api.github.com/users/zjamshed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zjamshed/subscriptions","organizations_url":"https://api.github.com/users/zjamshed/orgs","repos_url":"https://api.github.com/users/zjamshed/repos","events_url":"https://api.github.com/users/zjamshed/events{/privacy}","received_events_url":"https://api.github.com/users/zjamshed/received_events","type":"User","site_admin":false},"body":"#This runscript, run_analysis.R, performs the following tasks:\r\n\r\n#1. Merges the training and the test sets to create one data set.\r\n#2. Extracts only the measurements on the mean and standard deviation for each measurement. \r\n#3. Uses descriptive activity names to name the activities in the data set\r\n#4. Appropriately labels the data set with descriptive variable names. \r\n#5. From the data set in step 4, creates a second, independent tidy data set with the average \r\n#   of each variable for each activity and each subject.\r\nlibrary(reshape2)\r\n\r\n\r\n#Import features and labels\r\nactivity_labels<- read.table(\"./activity_labels.txt\")[,2]\r\nfeatures<- read.table(\"./features.txt\")[,2]\r\n\r\n#Import train and test\r\ntest_x<- read.table(\"./test/X_test.txt\")\r\nnames(test_x)<- features\r\ntest_y <- read.table(\"./test/y_test.txt\")\r\ntest_subject<- read.table(\"./test/subject_test.txt\")\r\n\r\ntrain_x<- read.table(\"./train/X_train.txt\")\r\nnames(train_x)<- features\r\ntrain_y<- read.table(\"./train/y_train.txt\")\r\ntrain_subject<- read.table(\"./train/subject_train.txt\")\r\n\r\n#Find only mean and stdev for each measurement\r\nexfeatures<- grepl(\"mean|std\", features)\r\n\r\n#Extract only the measurements on the mean and standard deviation for each measurement.\r\ntest_x<- test_x[,exfeatures]\r\ntrain_x<- train_x[,exfeatures]\r\n\r\n# Load activity labels for test and train\r\ntest_y[,2]<- activity_labels[test_y[,1]]\r\nnames(test_y)<- c(\"Activity_ID\", \"Activity_Label\")\r\nnames(test_subject)<- \"subject\"\r\n\r\ntrain_y[,2]<- activity_labels[train_y[,1]]\r\nnames(train_y)<- c(\"Activity_ID\", \"Activity_Label\")\r\nnames(train_subject)<- \"subject\"\r\n\r\n#Combine datasets\r\nCombineData<- rbind(cbind(test_subject, test_y, test_x),\r\n                    cbind(train_subject, train_y, train_x))\r\n#Rename the columns with descriptive names\r\nRenamed<-colnames(CombineData)\r\nRenamed<-gsub(\"tBody\", \"Time.Body\", Renamed)\r\nRenamed<- gsub(\"tGravity\", \"Time.Gravity\", Renamed)\r\nRenamed<- gsub(\"fBody\", \"FFT.Body\", Renamed)\r\nRenamed<- gsub(\"fGravity\", \"FFT.Gravity\", Renamed)\r\nRenamed<- gsub(\"\\\\-mean\\\\(\\\\)\\\\-\", \".Mean.\", Renamed)\r\nRenamed<- gsub(\"\\\\-std\\\\(\\\\)\\\\-\", \".Std.\", Renamed)\r\nRenamed<- gsub(\"\\\\-mean\\\\(\\\\)\", \".Mean\", Renamed)\r\nRenamed<- gsub(\"\\\\-std\\\\(\\\\)\", \".Std\", Renamed)\r\n\r\ncolnames(CombineData)<-Renamed\r\n\r\n#Reshape data\r\nid_labels<- c(\"subject\", \"Activity_ID\", \"Activity_Label\")\r\ndata_labels<- setdiff(colnames(CombineData), id_labels)\r\nMelted<- melt(CombineData, id<- id_labels, measure.vars<-data_labels)\r\n\r\n#Apply mean function to dataset using dcast function\r\ntidy_data<- dcast(Melted, subject + Activity_Label ~ variable, mean)\r\n\r\nwrite.table(tidy_data, file = \"./tidy_data.txt\",row.name=FALSE)\r\n","created_at":"2015-08-23T23:04:39Z","updated_at":"2015-08-23T23:04:55Z","closed_at":"2015-08-23T23:04:55Z","merged_at":"2015-08-23T23:04:55Z","merge_commit_sha":"72f049dd845313269bc3fc24d8a55b3dafeb8c0e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/pulls/1/commits","review_comments_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/pulls/1/comments","review_comment_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/issues/1/comments","statuses_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/statuses/722b896c84246e96131cef4a3667e21d0b9a43f6","head":{"label":"zjamshed:run_analysis.R","ref":"run_analysis.R","sha":"722b896c84246e96131cef4a3667e21d0b9a43f6","user":{"login":"zjamshed","id":11840674,"avatar_url":"https://avatars.githubusercontent.com/u/11840674?v=3","gravatar_id":"","url":"https://api.github.com/users/zjamshed","html_url":"https://github.com/zjamshed","followers_url":"https://api.github.com/users/zjamshed/followers","following_url":"https://api.github.com/users/zjamshed/following{/other_user}","gists_url":"https://api.github.com/users/zjamshed/gists{/gist_id}","starred_url":"https://api.github.com/users/zjamshed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zjamshed/subscriptions","organizations_url":"https://api.github.com/users/zjamshed/orgs","repos_url":"https://api.github.com/users/zjamshed/repos","events_url":"https://api.github.com/users/zjamshed/events{/privacy}","received_events_url":"https://api.github.com/users/zjamshed/received_events","type":"User","site_admin":false},"repo":{"id":41270895,"name":"-run_analysis.R","full_name":"zjamshed/-run_analysis.R","owner":{"login":"zjamshed","id":11840674,"avatar_url":"https://avatars.githubusercontent.com/u/11840674?v=3","gravatar_id":"","url":"https://api.github.com/users/zjamshed","html_url":"https://github.com/zjamshed","followers_url":"https://api.github.com/users/zjamshed/followers","following_url":"https://api.github.com/users/zjamshed/following{/other_user}","gists_url":"https://api.github.com/users/zjamshed/gists{/gist_id}","starred_url":"https://api.github.com/users/zjamshed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zjamshed/subscriptions","organizations_url":"https://api.github.com/users/zjamshed/orgs","repos_url":"https://api.github.com/users/zjamshed/repos","events_url":"https://api.github.com/users/zjamshed/events{/privacy}","received_events_url":"https://api.github.com/users/zjamshed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zjamshed/-run_analysis.R","description":"","fork":false,"url":"https://api.github.com/repos/zjamshed/-run_analysis.R","forks_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/forks","keys_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/teams","hooks_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/hooks","issue_events_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/issues/events{/number}","events_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/events","assignees_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/assignees{/user}","branches_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/branches{/branch}","tags_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/tags","blobs_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/git/refs{/sha}","trees_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/statuses/{sha}","languages_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/languages","stargazers_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/stargazers","contributors_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/contributors","subscribers_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/subscribers","subscription_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/subscription","commits_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/commits{/sha}","git_commits_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/git/commits{/sha}","comments_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/comments{/number}","issue_comment_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/issues/comments{/number}","contents_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/contents/{+path}","compare_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/merges","archive_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/downloads","issues_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/issues{/number}","pulls_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/pulls{/number}","milestones_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/milestones{/number}","notifications_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/labels{/name}","releases_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/releases{/id}","created_at":"2015-08-23T22:57:07Z","updated_at":"2015-08-23T22:57:07Z","pushed_at":"2015-08-23T23:04:55Z","git_url":"git://github.com/zjamshed/-run_analysis.R.git","ssh_url":"git@github.com:zjamshed/-run_analysis.R.git","clone_url":"https://github.com/zjamshed/-run_analysis.R.git","svn_url":"https://github.com/zjamshed/-run_analysis.R","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"zjamshed:master","ref":"master","sha":"62780c9043a6167e6ea2c5d4b23a4c05c6cb5137","user":{"login":"zjamshed","id":11840674,"avatar_url":"https://avatars.githubusercontent.com/u/11840674?v=3","gravatar_id":"","url":"https://api.github.com/users/zjamshed","html_url":"https://github.com/zjamshed","followers_url":"https://api.github.com/users/zjamshed/followers","following_url":"https://api.github.com/users/zjamshed/following{/other_user}","gists_url":"https://api.github.com/users/zjamshed/gists{/gist_id}","starred_url":"https://api.github.com/users/zjamshed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zjamshed/subscriptions","organizations_url":"https://api.github.com/users/zjamshed/orgs","repos_url":"https://api.github.com/users/zjamshed/repos","events_url":"https://api.github.com/users/zjamshed/events{/privacy}","received_events_url":"https://api.github.com/users/zjamshed/received_events","type":"User","site_admin":false},"repo":{"id":41270895,"name":"-run_analysis.R","full_name":"zjamshed/-run_analysis.R","owner":{"login":"zjamshed","id":11840674,"avatar_url":"https://avatars.githubusercontent.com/u/11840674?v=3","gravatar_id":"","url":"https://api.github.com/users/zjamshed","html_url":"https://github.com/zjamshed","followers_url":"https://api.github.com/users/zjamshed/followers","following_url":"https://api.github.com/users/zjamshed/following{/other_user}","gists_url":"https://api.github.com/users/zjamshed/gists{/gist_id}","starred_url":"https://api.github.com/users/zjamshed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zjamshed/subscriptions","organizations_url":"https://api.github.com/users/zjamshed/orgs","repos_url":"https://api.github.com/users/zjamshed/repos","events_url":"https://api.github.com/users/zjamshed/events{/privacy}","received_events_url":"https://api.github.com/users/zjamshed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zjamshed/-run_analysis.R","description":"","fork":false,"url":"https://api.github.com/repos/zjamshed/-run_analysis.R","forks_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/forks","keys_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/teams","hooks_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/hooks","issue_events_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/issues/events{/number}","events_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/events","assignees_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/assignees{/user}","branches_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/branches{/branch}","tags_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/tags","blobs_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/git/refs{/sha}","trees_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/statuses/{sha}","languages_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/languages","stargazers_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/stargazers","contributors_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/contributors","subscribers_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/subscribers","subscription_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/subscription","commits_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/commits{/sha}","git_commits_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/git/commits{/sha}","comments_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/comments{/number}","issue_comment_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/issues/comments{/number}","contents_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/contents/{+path}","compare_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/merges","archive_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/downloads","issues_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/issues{/number}","pulls_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/pulls{/number}","milestones_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/milestones{/number}","notifications_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/labels{/name}","releases_url":"https://api.github.com/repos/zjamshed/-run_analysis.R/releases{/id}","created_at":"2015-08-23T22:57:07Z","updated_at":"2015-08-23T22:57:07Z","pushed_at":"2015-08-23T23:04:55Z","git_url":"git://github.com/zjamshed/-run_analysis.R.git","ssh_url":"git@github.com:zjamshed/-run_analysis.R.git","clone_url":"https://github.com/zjamshed/-run_analysis.R.git","svn_url":"https://github.com/zjamshed/-run_analysis.R","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zjamshed/-run_analysis.R/pulls/1"},"html":{"href":"https://github.com/zjamshed/-run_analysis.R/pull/1"},"issue":{"href":"https://api.github.com/repos/zjamshed/-run_analysis.R/issues/1"},"comments":{"href":"https://api.github.com/repos/zjamshed/-run_analysis.R/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/zjamshed/-run_analysis.R/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/zjamshed/-run_analysis.R/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zjamshed/-run_analysis.R/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/zjamshed/-run_analysis.R/statuses/722b896c84246e96131cef4a3667e21d0b9a43f6"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"zjamshed","id":11840674,"avatar_url":"https://avatars.githubusercontent.com/u/11840674?v=3","gravatar_id":"","url":"https://api.github.com/users/zjamshed","html_url":"https://github.com/zjamshed","followers_url":"https://api.github.com/users/zjamshed/followers","following_url":"https://api.github.com/users/zjamshed/following{/other_user}","gists_url":"https://api.github.com/users/zjamshed/gists{/gist_id}","starred_url":"https://api.github.com/users/zjamshed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zjamshed/subscriptions","organizations_url":"https://api.github.com/users/zjamshed/orgs","repos_url":"https://api.github.com/users/zjamshed/repos","events_url":"https://api.github.com/users/zjamshed/events{/privacy}","received_events_url":"https://api.github.com/users/zjamshed/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":1,"additions":67,"deletions":1,"changed_files":1}}