代写代考 Starting with R and RMarkdown

Starting with R and RMarkdown

Starting with R and RMarkdown

Copyright By PowCoder代写 加微信 powcoder

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

The way you can create a file like this in RStudio is: File → → R Markdown and then using the default or using a template.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

Plotting some data

Here is code that will make a plot of the average daily ridership in Baltimore City for the Charm City Circulator: https://www.charmcitycirculator.com/.

Here we plot a few days:

# keep only some days
avg = avg %>%
filter(day %in% c(“Monday”, “Tuesday”, “Friday”, “Saturday”))

palette = c(
banner = “blue”,
green = “darkgreen”,
orange = “orange”,
purple = “purple”)

ggplot(aes(x = date, y = number, colour = line), data= avg) +
geom_line() +
facet_wrap( ~day) +
scale_colour_manual(values = palette)

Here are a few changes that will show you how to change small things in R code and the output it makes. After each change, hit the Knit button again.

Go through and change the colors in palette to something other than what they originally were. See http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf for a large list of colors.
Change the days you are keeping to show “Sunday” instead of “Saturday”.
Change the word geom_line() to geom_point().
Create another RMarkdown Document from RStudio dropdowns.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com