






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Section 1: Introduction Graphs are used to reveal general patterns by arranging the data we collect in a visual representation that allows us to make connections. The type of graph is dependent on the type of data, numerical or categorical and whether we must show measurements of one variable or two variables. Graphs are important for analyzing data and displaying patterns. A good graph will show the data, make the patterns in the data easy to see, represent magnitudes honestly and draw graphical elements clearly. When showing the data, you show each individual data point or frequency distribution to show their shape. We accomplish this when we can evaluate the shape of the distribution of the data points and can compare between groups. By doing this we can identify outliers or skews in the data which may be important during analysis. The next point is making the patterns easy to see which means that we use different graphs to show different types of data clearly. We also try to avoid including too much information in one graph because the main point is to identify essential patterns and confuse yourself with too much. We must represent magnitudes honestly by producing a reasonable scale to represent your data as well as a baseline to make comparison. Another aspect of a good graph is drawing all elements clearly by labelling axes and making everything legible through the fonts and colors you select. You also much include the units of measurement and symbols that will convey the information clearly. The first learning outcome is to know some basic graphical formats and when they are useful. The second learning outcome is making graphs in R such as histograms, bar charts3, box plots, and scatter plots. The last learning outcome is to be able to suggest improvements to basic graphs to improve readability and accurate communication.
In the graph displayed above, we use the dataset countries.csv to make inferences about the immunization rates of one-year olds for measles using the ggplot. The graph shows the distribution of the data to be skewed to the left which means that there was a high number of measle immunization for one-year olds. This shows that many countries have a high number of immunizations and only a few countries have a low recorded amount of measle immunization for one-year olds. I produce this graph by using the code ggplot (countries.csv, aes(x=measles_immunization_oneyearolds)) + geom_histogram () which specifies the data set as well as the variable being plotted.
d) Make a bar graph to show the numbers of countries in each of the continents. (The categorical variable continent indicates the continent to which countries belong.) I used the code ggplot (countries.csv, aes(x=continent)) + geom_bar (stat = "count") to produce this bar graph. The graph shows the number of countries in each continent.
Section 3: Question 5 (R scripts & graphs) (40pts)
d) Let’s figure out which species is the outlier. To do this, we’ll use a useful function called filter() from the package dplyr. Use library to load dplyr to your R session. When you filter the data through the variable, tongue length, we find that the outlier is Anoura fistulata which has a palate length of 12.4 and tongue length of 85.2. e) The function filter () gives us the row (or rows) of a data frame that has a certain property. Looking at the graph, we can tell that the point we are interested in has a very long tongue length, at least over 80 mm long! The following command will pull out the rows of the data frame bat_tongues that have tongue_length greater than 80 mm: {r eval=FALSE} filter (bat_tongues, tongue_length>80) filter (BatTongues.csv, tongue_length>80) species palate_length tongue_length 1 Anoura fistulata 12.4 85. Section 4: Conclusions (10 pts) a. Make sure that you have run library(ggplot2). Why is this necessary for the remainder of this question? Running the library(ggplot2) is necessary for the remainder of this question because we will be producing graphs that will help us to interpret our data and discover patterns based on the shape, scale, the presence or absence of outliners etc.… Therefore, it is important for us to use
the ggplot function to allow us to graph our data simply by specifying our data frame and our variables that will be plotted. b. What have you learned about the relationship between the two numerical variables life_expectancy_at_birth_male and life_expectancy_at_birth_female? The relationship between life expectancy at birth male and life expectancy at birth female has a strong positive correlation between the two variables which indicates a strong relationship between the two variables. c. After you have run the filter function, what species did you find is the outlier? After you apply the filter function to the tongue varaible, the species, Anoura fistulata is the outlier that has an above average tongue length of greater than 80 mm long. Section 5: Feedbacks a. What have you learned in this lab? (5 pts) In this lab, I was able to learn how to use the function ggplot to produce effective graphs that allow me to detect patterns and form conclusions about the data by simply indicating the data set and the variables that had to be plotted. This lab is a great way to understand the data we are using and visualize patterns which we can draw conclusions from. We can develop patterns and conclusions from the shape of the graph, the correlation between the variables, the skew of the data, the outliers and the many other aspects we can observe.