markdown doesn't work in R -


i make markdown wih r code, says without code each time, in markdown file, there code , text. furthermore code structure not respected. know why doesn't work ? didn't find answer...

> ```{r setup, include=false} knitr::opts_chunk$set(echo = true) ``` >  > # assignment >  > ## first question >  > read dataset in "data" , make column "date" date > format >  > '''{r} data<-read.csv(file="activity.csv",header=true) > data$date<-as.date(as.character(data$date),"%y-%m-%d") ''' >  > ## second question >  > histogram of total number of steps taken each day >  > '''{r} library("ggplot2") > perday<-aggregate(data$steps,list(date=data$date),sum) > qplot(perday$x,main="histogram of total number of steps taken each > day",xlab="number of steps") ''' 

it did same output above.

i don't understand why...

the problem in code when creating code chunk. should this:

```{r} # code here ``` 

with backquote ` (ctrl + alt + 7 ou altgr + 7 on windows) , not simple quote '

the easiest way create rmarkdown use rstudio , use button or keyboard shortcut insert chunk. ctrl + alt + on windows.

your correct code should be

```{r setup, include=false}  knitr::opts_chunk$set(echo = true) ```  # assignment  ## first question  read dataset in "data" , make column "date" date format  ```{r}  data<-read.csv(file="activity.csv",header=true) data$date<-as.date(as.character(data$date),"%y-%m-%d" ```  ## second question  histogram of total number of steps taken each day  ```{r}  library("ggplot2") perday<-aggregate(data$steps,list(date=data$date),sum) qplot(perday$x,main="histogram of total number of steps taken each  day",xlab="number of steps") ``` 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -