Lab Assignment - R Basics and Working with Data

Assignment Help Other Subject
Reference no: EM132451643

Lab Assignment - R Basics and Working with Data: Introduction to Statistical Reasoning

Objectives -

1. Demonstrate basic R Skills (create vectors, perform vector operations, install packages).

2. Use basic statistical functions (mean, min, max, median, sd).

3. Visualize data (dot plot, histogram, box plot, contingency tables, scatter plot, bubble plot).

Section 1 - R and RStudio Basics - Exercises

1 - Vectors:

a. Create a vector named heights that contains the heights, in inches, of yourself and two students near you. Print the contents of this vector.

b. Create a vector named names that contains the names of these people. Print the contents of this vector.

c. Try typing cbind(heights, names). What did this command do? What class is this new object?

Hint: Try the class() function.

2 - Downloading data:

a. Download the data set births.csv from the CCLE site and upload it into RStudio. Name the data frame NCbirths.

b. Demonstrate that you have been successful by typing head(NCbirths) and copying and pasting the output into your word processing document.

3 - Load the maps package:

a. Install the maps package. Verify its installation by typing find.package("maps") and include the output in your answer.

b. Type library(maps) to load up the package. Type map("state") and include the plot output in your answer.

4 - Perform vector operations:

a. Extract the weight variable as a vector from the data frame by typing weights <- NCbirths$weight

b. What units do you think the weights are in?

c. Create a new vector named weights_in_pounds which are the weights of the babies in pounds. You can look up conversion factors on the internet.

d. Demonstrate your success by typing weights_in_pounds[1:20] and including the output in your word processing document.

Section 2 - Summarizing Data (one variable) - Exercises

1. What is the mean weight of the babies in pounds?

2. What percentage of the mothers in the sample smoke? Hint: use the tally function with the format argument. Use the help screen for guidance.

3. According to the Centers for Disease Control, approximately 21% of adult Americans are smokers. How far off is the percentage you found in 2 from the CDC's report?

Section 3 - Visualizing Data (one quantitative variable) - Exercises

1. Produce a dot plot of the weights in pounds.

2. Produce three different histograms of the weights in pounds. Use 3 bins, 20 bins, and 100 bins. Which histogram seems to give the best visualization, and why?

3. We can use the syntax boxplot(vector1, vector2) to make a side by side box plot. Create a side by side boxplot of the mother's ages and the father's ages. Which gender tends to be older?

4. Try typing histogram(~ weight | Habit, data = NCbirths, layout = c(1, 2)). Describe what this code does. Based on the graph, do you see any major differences between baby weights from smoking moms vs. non-smoking moms?

Section 4 - Visualizing Data (two categorical) - Exercises

1. Consider the other categorical variables in this data. Of those that record the health of the baby, which do you think will be associated with the mother's smoking and why? Make a two-way Summary Table to check your hypothesis. Do you have evidence that this variable associated with smoking? Why?

Section 5 - Visualizing Data (two quantitative) - Exercises

1. Produce a nicely formatted scatter plot of the weight of the baby vs. the mother's age.

Section 6 - Visualizing Data (geographic data) - Exercises

1. To demonstrate you have followed the handout, produce a modified version of the colored bubble plot. Rename the title to "California ozone bubble plot". Also, use a different point style, and different colors for each air quality category.

Attachment:- R Basics and Working with Data Lab Assignment File.rar

Reference no: EM132451643

Questions Cloud

Is job order or process costing a viable option for company : Why did company management think it was necessary to install an ABC system? Do you agree with their reasoning? Explain your answer.
Describe various definitions of stress : Describe various definitions of stress, including the difference between stimulus-based and response-based stress and good stress and bad stress.
Discuss about the film good will hunting : Determine how it hints at or suggests the concept of the American Dream.What is the process to build an annotated bibliography?
Grand theory or mid range theory : Write an assignment of 500-600 words on grand theory or mid range theory.The objective is to convince your peers of the value of grande theory
Lab Assignment - R Basics and Working with Data : Lab Assignment - R Basics and Working with Data: Introduction to Statistical Reasoning. Create a vector named heights that contains the heights, in inches
How are you feeling about your skills as a counselor : How are you feeling about your skills as a counselor? Is there a particular area of concern? What has been the most helpful in developing counseling skills.
How HITECH Act is benchmark development in US Healthcare : Identify how the HITECH Act is a benchmark development in U. S. Healthcare. Use peer-reviewed journal articles to support your response
Create an activity plan for attaining knowledge and skills : Create an Activity Plan with your site supervisor that identifies the plan for attaining the knowledge and skills identified in the Learning Contract.
Explain how investors can use the securities : Explain the content of each report listed below in detail and how it relates to your assessment of Amazon's.com financial performance.

Reviews

Write a Review

Other Subject Questions & Answers

  Why incorporate active approaches to social studies

Why incorporate active and thoughtful approaches to social studies in our instructional practices? Make sure to discuss activities and assessments.

  Speech challenge the economic policies of the 1920

How did the ideas expressed by FDR in his speech challenge the economic policies of the 1920s?

  Define a financial adviser to earn commissions

Corporations have been granted freedom of speech, freedom from unreasonable searchs and seizure, and due process of law

  Wat relationship do you see between ethics awareness

what relationship if any do you see between the ethics awareness inventory core concepts and the barnum effect? what

  Define the five essential element of an enforceable contract

Define the five essential elements of an enforceable contract, and demonstrate how each element relates to your example.

  Expected monetary value

For a particular risk, if the probability is 10% and the impact is -$20,000, then the expected monetary value (EMV) is:

  Define worsening of the cough when she has been exposed

She has noticed worsening of the cough when she has been exposed to smoke from bonfires

  How have new health care technologies control costs

How have new health care technologies and pressures to control health care costs affected nurses and nursing practice? Has it affected the characteristics of nurses and nursing

  Analyze the given case

Write a 700- to 1,050-word executive summary in Microsoft Word in the third person voice in which you analyze the case by addressing the following: Defend against or support the position of the plaintiff

  How did the patterns of trade in the islamic world change

How did the patterns of trade in the Islamic world change between 1400 and 1700? Why? What were the consequences? Of the change in trade for the five groups of Islamic societies that we have discussed?

  Who has the opposite opinion of yours in this instance

Given the difference of opinions on the issue of forgiveness and revenge by mental health professionals and individuals in general, what are the ethical considerations if you are treating a patient who has the opposite opinion of yours in this ins..

  Explain how the current cdc guidelines may be applied

Briefly, explain how the current CDC guidelines may be applied to advanced practice nursing in patient education to prevent food-drug interactions.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd