For this assignment, I am using the stars dataset in the dslabs package. Based on the view and summary function I used below, the variables of this dataset are star name, magnitude, temperature, and type.
#download and install packages and librarylibrary(dslabs)data("stars") summary(stars)
star magnitude temp type
Altair : 2 Min. :-8.000 Min. : 2500 Length :96
*40EridaniA: 1 1st Qu.:-1.800 1st Qu.: 3168 N.unique :10
*40EridaniB: 1 Median : 2.400 Median : 5050 N.blank : 0
*40EridaniC: 1 Mean : 4.257 Mean : 8752 Min.nchar: 1
*61CygniA : 1 3rd Qu.:11.325 3rd Qu.: 9900 Max.nchar: 2
*61CygniB : 1 Max. :17.000 Max. :33600
(Other) :89
#View(stars)
#treemaplibrary(treemap)#data source:https://cran.r-project.org/web/packages/dslabs/index.html"treemap(stars,index ="star",vSize ="temp",vColor ="temp",type ="value",title ="Temperature of Stars in Our Solar System",palette ="RdYlBu") #Found on here: https://r-graph-gallery.com/38-rcolorbrewers-palettes.html
library(ggplot2)ggplot(data = stars, aes(x = temp, y = magnitude, color = type)) +geom_point(shape =8, size =3) +#make them star shapedtheme_light() +labs(title ="Temperature and Magnitude of Stars based on Type", caption ="Source: DSLABS")
For this assignment, I am using the stars dataset in the dslabs package. Based on the view and summary function I used below, the variables of this dataset are star name, magnitude, temperature, and type. In this scatter plot, each plot represents a star. The color of the plot indicates the type of star. There is a strong connection between the magnitude, temperature and star type. This is evident by the clusters of the same color. The results are logical since star types are determined by temperature and luminosity, so stars with similar temperature and magnitude would likely be categorized as the same type of star.