Clone this repository onto your local machines. In your groups, make changes as necessary to this single README.md file only. To be clear, you are allowed to add files to this repo (e.g. images), but the main concentration of effort is this README file.
Once you are done the group leader is responsible for submitting the final repo.
Optional: For extra points, prettify your GitHub repo: Add descriptions, about, titles, create a GH page, etc.
(remove any unnecessary parts) Each group member should fill in their respective parts.
- Name: Ang Woan Yean
- Student ID: 19B2068
- Favourite book: ...
- Favourite number: 8
- Favourite mathematical equation: E=mc^2
- Insert an inspiring photo:
- Name: Soon Chin Yuen
- Student ID: 19B2155
- Favourite book: -
- Favourite number: 8
- Favourite mathematical equation: y=mx+c
- Insert an inspiring photo:
(remove unnecessary parts when done)
In the previous exercise you used the R function called ggsave()
.
Your task is to copy over the relevant parts from the R help file regarding the ggsave()
function.
In particular, this section should be populated (only) with
-
Description ggsave() is a convenient function for saving a plot. It defaults to saving the last plot that you displayed, using the size of the current graphics device. It also guesses the type of graphics device from the extension.
-
Usage ggsave( filename, plot = last_plot(), device = NULL, path = NULL, scale = 1, width = NA, height = NA, units = c("in", "cm", "mm", "px"), dpi = 300, limitsize = TRUE, bg = NULL, ... )
-
Details Note: Filenames with page numbers can be generated by including a C integer format expression, such as %03d (as in the default file name for most R graphics devices, see e.g. png()). Thus, filename = "figure%03d.png" will produce successive filenames figure001.png, figure002.png, figure003.png, etc. To write a filename containing the % sign, use %%. For example, filename = "figure-100%%.png" will produce the filename figure-100%.png.
-
Examples
ggplot(mtcars, aes(mpg, wt)) + geom_point()
ggsave("mtcars.pdf") ggsave("mtcars.png")
ggsave("mtcars.pdf", width = 4, height = 4) ggsave("mtcars.pdf", width = 20, height = 20, units = "cm")
unlink("mtcars.pdf") unlink("mtcars.png")
file <- tempfile() ggsave(file, device = "pdf") unlink(file)
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() png("mtcars.png") print(p) dev.off()
In addition, answer the following question:
The purpose of the arguments
width
andheight
in theggsave()
function is the dimensions of the graph. These plot size in units can be in "in", "cm", "mm", or "px". If units are not supplied, it uses the size of current graphics device.
This section of the Markdown file should be formatted nicely so that code is formatted as code, headings as headings, etc. Use the Markdown Cheat Sheet to help you out.