MGG exam 8 – Q’s and A’s
What is the first input necessary? - - library(ggplot2)
- How do you set your basic plot to a variable (P)? - - p <- ggplot(dataset,
aes(x,y))
- What must you add to get a graph? - - a geom statement -
p+geom_point()
- How do you add color to your ggplot? - - p+geom_point(aes(color=cyl))
- What is the difference between p+geom_point(aes(color=cyl)) and
p+geom_point(aes(color=factor(cyl)))? - - without the factor, the values are
regarded as continuous numerics
- How do you make data points different shapes? - -
p+geom_point(aes(shape=factor(cyl)))
- Is "cyl" a discrete or continuous variable? - - discrete
- What happens when you try to assign shape to continuous variables? - -
an error message will appear
- Is "qsec" a discrete or continuous variable? - - continuous
- What is a good way to show continuous numerical data? - - by changing
size
- What is difficult with a large dataset? - - the points become so crowded
that it is difficult to distinguish
- What can you do to make a large dataset easier to read? - - change alpha
(transparency)
- How do you change alpha? - - d+geom_point(alpha=1/100)
- What is the difference between "color" and "fill" - - color indicates
perimeter of the point and fill indicates interior of the point
- How do you add labels to the x and y axis? - - by writing +labs(x = "title of
x axis" , y = "title of y axis")
- How do you scale the plot? - - scale_x_continuous(limits = c(3,4))
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Victorious23. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $8.49. You're not tied to anything after your purchase.