Markdown常用語法

一級(jí)標(biāo)題

二級(jí)標(biāo)題

三級(jí)標(biāo)題

四級(jí)標(biāo)題

五級(jí)標(biāo)題
六級(jí)標(biāo)題

列表

  • 列表1
  • 列表2
  • 列表3

有序文本

  1. 有序文本1
  2. 有序文本2
  3. 有序文本3

超鏈接簡(jiǎn)書

圖片
圖片

Project for Getting and Cleaning Data

Author: Benjamin Chan (https://github.com/benjamin-chan/GettingAndCleaningData)

Parameters for the project

The purpose of this project is to demonstrate your ability to collect, work with, and clean a data set. The goal is to prepare tidy data that can be used for later analysis. You will be graded by your peers on a series of yes/no questions related to the project. You will be required to submit: 1) a tidy data set as described below, 2) a link to a Github repository with your script for performing the analysis, and 3) a code book that describes the variables, the data, and any transformations or work that you performed to clean up the data called CodeBook.md. You should also include a README.md in the repo with your scripts. This repo explains how all of the scripts work and how they are connected.
http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones

Here are the data for the project:

https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip

You should create one R script called run_analysis.R that does the following.

  1. Merges the training and the test sets to create one data set.
  2. Extracts only the measurements on the mean and standard deviation for each measurement.
  3. Uses descriptive activity names to name the activities in the data set.
  4. Appropriately labels the data set with descriptive activity names.
  5. Creates a second, independent tidy data set with the average of each variable for each activity and each subject.

Good luck!

Steps to reproduce this project

  1. Open the R script run_analysis.r using a text editor.
  2. Change the parameter of the setwd function call to the working directory/folder (i.e., the folder where these the R script file is saved).
  3. Run the R script run_analysis.r. It calls the R Markdown file, run_analysis.Rmd, which contains the bulk of the code.

Outputs produced

  • Tidy dataset file DatasetHumanActivityRecognitionUsingSmartphones.txt (tab-delimited text)
  • Codebook file codebook.md (Markdown)

Test script

a <- c(1,1,2,3,4,5,6,7,8,9)

asd

Preliminaries

Load packages.

packages <- c("data.table", "reshape2")
sapply(packages, require, character.only = TRUE, quietly = TRUE)
## data.table   reshape2 
##       TRUE       TRUE

Set path.

path <- getwd()
path
## [1] "C:/Users/chanb/Documents/Repositories/Coursera/GettingAndCleaningData/Project"

Get the data

Download the file. Put it in the Data folder. This was already done on 2014-04-11; save time and don't evaluate again.

url <- "https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip"
f <- "Dataset.zip"
if (!file.exists(path)) {
    dir.create(path)
}
download.file(url, file.path(path, f))

Unzip the file. This was already done on 2014-04-11; save time and don't evaluate again.

executable <- file.path("C:", "Program Files (x86)", "7-Zip", "7z.exe")
parameters <- "x"
cmd <- paste(paste0("\"", executable, "\""), parameters, paste0("\"", file.path(path, 
    f), "\""))
system(cmd)

The archive put the files in a folder named UCI HAR Dataset. Set this folder as the input path. List the files here.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 次日的墨漪醒來已經(jīng)是八點(diǎn),離上班時(shí)間僅有半個(gè)小時(shí)。 他看了一眼手中的手機(jī),依然悄無聲息的毫無動(dòng)靜,就如同他死了一般...
    阿鶴閱讀 493評(píng)論 0 0
  • 春之韻 遠(yuǎn)燈 2017.2.21 低下頭 來聽我的呼吸隨大地顫抖 布谷鳥在鳴叫 它唱著春天的第一首歌 遙遠(yuǎn)村莊里五...
    宋大圣閱讀 268評(píng)論 0 4
  • 過春節(jié)前一周,不知從哪里看到優(yōu)達(dá)學(xué)城(Udacity)的深度學(xué)習(xí)(Deep learning)課程在搞優(yōu)惠活動(dòng),抱...
    bmy閱讀 9,442評(píng)論 5 33

友情鏈接更多精彩內(nèi)容