Air Pollution Data Analysis with R functions

Benedict neo, loading packages, pollutant mean function, example outputs, complete function, example outputs, session info, introduction.

For this first programming assignment you will write three functions that are meant to interact with dataset that accompanies this assignment. The dataset is contained in a zip file specdata.zip that you can download from the Coursera web sit

The zip file containing the data can be downloaded here:

  • specdata.zip [2.4MB]

The zip file contains 332 comma-separated-value (CSV) files containing pollution monitoring data for fine particulate matter (PM) air pollution at 332 locations in the United States. Each file contains data from a single monitor and the ID number for each monitor is contained in the file name. For example, data for monitor 200 is contained in the file “200.csv”. Each file contains three variables:

  • Date: the date of the observation in YYYY-MM-DD format (year-month-day)
  • sulfate: the level of sulfate PM in the air on that date (measured in micrograms per cubic meter)
  • nitrate: the level of nitrate PM in the air on that date (measured in micrograms per cubic meter)

For this programming assignment you will need to unzip this file and create the directory ‘specdata’. Once you have unzipped the zip file, do not make any modifications to the files in the ‘specdata’ directory. In each file you’ll notice that there are many days where either sulfate or nitrate (or both) are missing (coded as NA). This is common with air pollution monitoring data in the United States.

Write a function named ‘pollutantmean’ that calculates the mean of a pollutant (sulfate or nitrate) across a specified list of monitors. The function ‘pollutantmean’ takes three arguments: ‘directory’, ‘pollutant’, and ‘id’. Given a vector monitor ID numbers, ‘pollutantmean’ reads that monitors’ particulate matter data from the directory specified in the ‘directory’ argument and returns the mean of the pollutant across all of the monitors, ignoring any missing values coded as NA.

Write a function that reads a directory full of files and reports the number of completely observed cases in each data file. The function should return a data frame where the first column is the name of the file and the second column is the number of complete cases. A prototype of this function follows

Write a function that takes a directory of data files and a threshold for complete cases and calculates the correlation between sulfate and nitrate for monitor locations where the number of completely observed cases (on all variables) is greater than the threshold. The function should return a vector of correlations for the monitors that meet the threshold requirement. If no monitors meet the threshold requirement, then the function should return a numeric vector of length 0. A prototype of this function follows

  • [Programming Assignment 1] R Programming
  • by Anderson Hitoshi Uyekita
  • Last updated almost 2 years ago
  • Hide Comments (–) Share Hide Toolbars

Twitter Facebook Google+

Or copy & paste this link into an email or IM:

Coursera R-Programming: Week 2 Problems

The Tidy Approach

Josiah Parry

April 14, 2018

Over the past several weeks I have been helping students, career professionals, and people of other backgrounds learn R. During this time one this has become apparent, people are teaching the old paradigm of R and avoiding the tidyverse all together.

I recently had a student reach out to me in need of help with the first programming assignment from the Coursera R-Programming course (part of the Johns Hopkins Data Science Specialization). This particular student was struggling with combining the her new knowledge of R data types, conditional statements, looping, control statements, scoping, and functions to solve the assignment problem set. I provided her with a walk through of each question in base R, the style of the course. I couldn’t help but empathize with her as I too learned the long way first. However I thought that she shouldn’t be learning the hard way first (see David Robinson’s blog post , “Don’t teach students the hard way first” ), she should be learning the effective way.

In my written response to her, I gave her solutions to her problems in base R and using the tidyverse. Here, I will go over the problems and adress them from a tidy perspective. This will not serve as a full introduction to the tidyverse. For an introduction and a reason why the tidyverse is superior to base R, I leave you with Stat 545 : Introduction to dplyr

The assignment utilizes a directory of data called specdata which can be downloaded here , and describes it:

The zip file contains 332 comma-separated-value (CSV) files containing pollution monitoring data for fine particulate matter (PM) air pollution at 332 locations in the United States. Each file contains data from a single monitor and the ID number for each monitor is contained in the file name. For example, data for monitor 200 is contained in the file “200.csv”. Each file contains three variables:
Date : the date of the observation in YYYY-MM-DD format (year-month-day) sulfate : the level of sulfate PM in the air on that date (measured in micrograms per cubic meter) nitrate : the level of nitrate PM in the air on that date (measured in micrograms per cubic meter)
For this programming assignment you will need to unzip this file and create the directory ‘specdata’. Once you have unzipped the zip file, do not make any modifications to the files in the ‘specdata’ directory. In each file you’ll notice that there are many days where either sulfate or nitrate (or both) are missing (coded as NA). This is common with air pollution monitoring data in the United States.
Write a function named ‘pollutantmean’ that calculates the mean of a pollutant (sulfate or nitrate) across a specified list of monitors. The function ‘pollutantmean’ takes three arguments: ‘directory’, ‘pollutant’, and ‘id’. Given a vector monitor ID numbers, ‘pollutantmean’ reads that monitors’ particulate matter data from the directory specified in the ‘directory’ argument and returns the mean of the pollutant across all of the monitors, ignoring any missing values coded as NA. A prototype of the function is as follows

Before we tackle the function, I believe the best approach is to first solve the problem in a regular script. This problem has four clear steps:

  • Identify files in the directory
  • Subset files based on provided ID
  • Read the files
  • Calculate and return the mean on the desired column

This problem gives us a directory of files from which we need to read in the data based on the provided IDs. For the sake of this walk through we will randomly sample 10 values within the range designated in the problem statement (332).

We will first generate random IDs, then identify all of the files within the specified directory and obtain their file paths using the list.files() function. After this we will subset our file list based on the IDs, then iterate over our file list and read in each file as a csv using purrr:map_df() combined with readr::read_csv() . Fortunately map_df() returns a nice and pretty data frame which lets us avoid having to explicitly bind each unique data frame.

Identify Files

Here we create 10 random IDs and store them in the ids variable. Next we use list.files() to look within the specdata folder that we downloaded above. Everyone’s path will most likely be different. Be sure to obtain the correct file path—help for Mac .

Next we identify the files we need based on the sampled ids and store the subset in the files_filtered variable. We use the values of the ids to locate the file paths positionally. For example, ID number 1 is the first file, number 10 is the tenth, etc.

Reading the Files

Now that we have identified the files that we are going to read in, we can use purrr:map_df() to apply the readr::read_csv() function to each value of files_filtered and return a data frame (hence the _df() suffix). We supply additional arguments to read_csv() to ensure that every column is read in properly.

Next, we get to utilize some dplyr magic. Here we take the specdata object we created from reading in our files, deselct the Date column, then utilize summarise_if() to apply the mean() function to our data. summarise_if() requires that we provide a logical statement as the first argument. If (hence the _if() suffix) the logical statement evaluates to TRUE on a column then it will apply a list of functions to those columns where the statement evaluated to TRUE . We can also specify additional arguments to the functions. Here we specify na.rm = TRUE for handling missing values.

In this case, we are checking to see if our columns are of the data type double using the is.double() function. If you’re wondering why we didn’t use is.numeric() , it’s because the ID column is an integer which is considered numeric.

If we wanted to take the underlying vector of one of the columns, we can also, use dplyr::pull(col_name) . This will be helpful later when we want to obtain the mean of just one column.

Now that we have all of the tools, we can put this together into a single function, which I will call pollutant_mean() to somewhat adhere—functions should take the name of verbs—to the tidyverse style guide.

Here we have three arguments:

  • directory : Where to look for the files
  • This needs to be a character value unless we want to get into tidyeval , which frankly I will leave to the professionals. But I will provide an alternative solution at the end that doesn’t require quoted pollutant names.
  • id : Which monitoring stations we should look at

Within the function we take everything we did in the above steps but generalize it to a function. We identify the files in the directory provided ( specdata ), subset the files positionally based on the provided id vector, and then iterate over the file names and read them in with map_df() and read_csv() .

Next we take our data and calculate the mean on both sulfate and nitrate columns. We then pull() the specified column from the pollutant argument and then return() that value.

Here we can test out the function with both types of pollutants and different id values.

Let us continue to the second problem in the problem set.

Write a function that reads a directory full of files and reports the number of completely observed cases in each data file. The function should return a data frame where the first column is the name of the file and the second column is the number of complete cases.

The assignment provides an example function format, but I think it to be a bit misleading. So I will go about this in the way I think is best. We will work on creating a function called complete_spec_cases() which will take only two arguments, directory , and id . directory and id will be used in the the same way as the previous problem.

For this problem our goal is to identify how many complete cases there are by provided ID. This should be exceptionally simple. We will have to identify our files, subset them, and read them in the same way as before. Next we can identify complete cases by piping our specdata object to na.omit() which will remove any row with a missing value. Next, we have to group by the ID column and pipe our grouped data frame to count() which will count how many observations there are by group. We will then return this data frame to the user.

This final problem is probably the most complicated, but with the method we just used above and with a bit more help from the purrr and dplyr packages, we can do this no problem.

Write a function that takes a directory of data files and a threshold for complete cases and calculates the correlation between sulfate and nitrate for monitor locations where the number of completely observed cases (on all variables) is greater than the threshold. The function should return a vector of correlations for the monitors that meet the threshold requirement. If no monitors meet the threshold requirement, then the function should return a numeric vector of length 0. A prototype of this function follows:

Let keep this simple. The above statement essentially is asking that we find the correlation between nitrate and sulfate for each monitoring station (ID). But there is a catch! Each ID must meet a specified threshold of complete cases, and if none of the monitors meet the requirement the function must return a numeric(0) .

The way we will structure this function will be to first read in the data—as we have done twice now, except this time there will be no subsetting of IDs. Then we need to identify the number of complete cases by ID—as we did in problem 2—and identify the stations that meet the threshold requirement. At this point we will use an if statement to check if we have at least 1 monitoring station that meets our threshold, if we do not, we return the numeric(0) —there is most likely a more tidy way to do this, but I am not aware. If we have at least 1 monitoring station that meets the specified threshold we will use an inner_join() to make sure that specdata contains only those IDs that meet the requirement.

For the sake of this example, we will continue to use the specdata object we created in previous examples, and we will set our threshold to 100. Once we identify the stations with the proper number of counts ( > 100 ), we will store that data frame in an object called id_counts

This is where it gets kind of funky. Once we have filtered down our data set, we need to calculate the correlations for each ID. The way that we do this is by nesting our data frame on the ID column. Calling nest(-ID) allows us to, for each value of ID, create a data frame for just those rows where the ID is the same. We will then have a new list type column where each value is actually a data frame. Let’s check out what this looks like before we hop into the function.

Now that we know how to nest our data, we need to calculate the correlations for each row (ID value). We will do this by combining mutate() and map() . Here .x references the data that is within each nested tibble. To learn more about purrr I recommend the chapter on iteration from R For Data Science .

After we have done our calculations we undo our nesting using unnest() on the new column we created, and deselect the data column.

We can now place these above examples within a new function called pollutant_cor() .

We can now test our function against two different thresholds to see how it reacts.

If we set the threshold to 100,000, we should expect a numeric(0) .

It all works!

  • Show All Code
  • Hide All Code
  • Download Rmd

R Programming Week 2: Assignment 1

Initialisation.

Configure evironment

The function ‘pollutantmean’ calculates the mean of a pollutant (sulfate or nitrate) across a specified list of monitors. The function ‘pollutantmean’ takes three arguments: ‘directory’, ‘pollutant’, and ‘id’. Given a vector monitor ID numbers, ‘pollutantmean’ reads that monitors’ particulate matter data from the directory specified in the ‘directory’ argument and returns the mean of the pollutant across all of the monitors, ignoring any missing values coded as NA.

The function ‘complete’ reads a directory full of files and reports the number of completely observed cases in each data file. The function should return a data frame where the first column is the name of the file and the second column is the number of complete cases.

The function ‘corr’ takes a directory of data files and a threshold for complete cases and calculates the correlation between sulfate and nitrate for monitor locations where the number of completely observed cases (on all variables) is greater than the threshold. The function should return a vector of correlations for the monitors that meet the threshold requirement. If no monitors meet the threshold requirement, then the function should return a numeric vector of length 0.

Q1. What value is returned by the following call to pollutantmean()? You should round your output to 3 digits.

Q2. What value is returned by the following call to pollutantmean()? You should round your output to 3 digits.

Q3. What value is returned by the following call to pollutantmean()? You should round your output to 3 digits.

Q4. What value is returned by the following call to pollutantmean()? You should round your output to 3 digits.

Q5. What value is printed at end of the following code?

Q6. What value is printed at end of the following code?

Q7. What value is printed at end of the following code?

Q8. What value is printed at end of the following code?

Q9. What value is printed at end of the following code?

Q10. What value is printed at end of the following code?

R Programming Assignment 1: Air Pollution

Introduction.

For this first programming assignment you will write three functions that are meant to interact with dataset that accompanies this assignment. The dataset is contained in a zip file specdata.zip that you can download from the Coursera web site.

The zip file containing the data can be downloaded here:

  • specdata.zip [2.4MB]

The zip file contains 332 comma-separated-value (CSV) files containing pollution monitoring data for fine particulate matter (PM) air pollution at 332 locations in the United States. Each file contains data from a single monitor and the ID number for each monitor is contained in the file name. For example, data for monitor 200 is contained in the file “200.csv”. Each file contains three variables:

Date: the date of the observation in YYYY-MM-DD format (year-month-day)

sulfate: the level of sulfate PM in the air on that date (measured in micrograms per cubic meter)

nitrate: the level of nitrate PM in the air on that date (measured in micrograms per cubic meter)

For this programming assignment you will need to unzip this file and create the directory ‘specdata’. Once you have unzipped the zip file, do not make any modifications to the files in the ‘specdata’ directory. In each file you’ll notice that there are many days where either sulfate or nitrate (or both) are missing (coded as NA). This is common with air pollution monitoring data in the United States.

Write a function named ‘pollutantmean’ that calculates the mean of a pollutant (sulfate or nitrate) across a specified list of monitors. The function ‘pollutantmean’ takes three arguments: ‘directory’, ‘pollutant’, and ‘id’. Given a vector monitor ID numbers, ‘pollutantmean’ reads that monitors’ particulate matter data from the directory specified in the ‘directory’ argument and returns the mean of the pollutant across all of the monitors, ignoring any missing values coded as NA. A prototype of the function is as follows

You can see some example output from this function . The function that you write should be able to match this output. Please save your code to a file named pollutantmean.R .

Write a function that reads a directory full of files and reports the number of completely observed cases in each data file. The function should return a data frame where the first column is the name of the file and the second column is the number of complete cases. A prototype of this function follows

You can see some example output from this function . The function that you write should be able to match this output. Please save your code to a file named complete.R . To run the submit script for this part, make sure your working directory has the file complete.R in it.

Write a function that takes a directory of data files and a threshold for complete cases and calculates the correlation between sulfate and nitrate for monitor locations where the number of completely observed cases (on all variables) is greater than the threshold. The function should return a vector of correlations for the monitors that meet the threshold requirement. If no monitors meet the threshold requirement, then the function should return a numeric vector of length 0. A prototype of this function follows

For this function you will need to use the ‘cor’ function in R which calculates the correlation between two vectors. Please read the help page for this function via ‘?cor’ and make sure that you know how to use it. You can see some example output from this function . The function that you write should be able to match this output. Please save your code to a file named corr.R . To run the submit script for this part, make sure your working directory has the file corr.R in it.

My Solution

pollutantmean.R:

complete.R:

Screenshots

I am learning:

Work out the final solution:

I am really exciting when finishing this programming assignment!

  • 1. Introduction
  • 6.1. Part 1
  • 6.2. Part 2
  • 6.3. Part 3
  • 8. Screenshots

Instantly share code, notes, and snippets.

@mGalarnyk

mGalarnyk / assignment1.md

  • Download ZIP
  • Star 12 You must be signed in to star a gist
  • Fork 25 You must be signed in to fork a gist
  • Embed Embed this gist in your website.
  • Share Copy sharable link for this gist.
  • Clone via HTTPS Clone using the web URL.
  • Learn more about clone URLs
  • Save mGalarnyk/bef0d3194c04e296a6e9784eccdb36f4 to your computer and use it in GitHub Desktop.

R Programming Project 1

github repo for rest of specialization: Data Science Coursera

For this first programming assignment you will write three functions that are meant to interact with dataset that accompanies this assignment. The dataset is contained in a zip file specdata.zip that you can download from the Coursera web site.

Although this is a programming assignment, you will be assessed using a separate quiz.

The zip file containing the data can be downloaded here: specdata.zip [2.4MB] Description: The zip file contains 332 comma-separated-value (CSV) files containing pollution monitoring data.

Part 1 ( pollutantmean.R )

Part 2 ( complete.r ), part 3 ( corr.r ).

@SUSANKI

SUSANKI commented Jul 30, 2020

Thank u so much, It's a little bit complicated for me @-@

Sorry, something went wrong.

@Cyberclip

Cyberclip commented Sep 14, 2020

Here it says when I try to do part 1 that there's no package named 'data.table', what should I do?

@harshit229

harshit229 commented Oct 7, 2020

use rstudio

@Romeroc3

Romeroc3 commented Dec 27, 2020 • edited

Thank you very much for this assignment information. I am currently doing my case study on the refugee situation and I need to study data science to analyze the data. Interestingly, the idea for the research came spontaneously when I read https://samplius.com/free-essay-examples/refugee/ in preparation for lesson. These free essay examples got me interested more in migration and globalization issue. Therefore, I decided to do a little research, but I lack the skills to do a high-quality analysis of big data.

@kennethwoanyah

kennethwoanyah commented Feb 3, 2021

@SUSANKI yep, complicated for me too . lol. Works perfectly though.

@flaviaouyang

flaviaouyang commented Feb 18, 2021

you need to install the package. install.packages(data.table)

@Bell-016

Bell-016 commented Feb 23, 2021

I am very frustrated with this course. I took it assuming it will explain things from the beggining for a beginner, but the first assignment to me is unreadble, I would never give this answer because I felt I never learn this things you used for your answer.

@utamadonny

utamadonny commented Mar 16, 2022

i run the corr.R and it return "Error in eval(bysub, parent.frame(), parent.frame()) : object 'ID' not found"

@Rushield

Rushield commented Apr 9, 2022

Bruh this course is just annoying because it ain't show us how to do those things, even understanding your simplified code in a week 2 is damn hard.

@emcdowell28

emcdowell28 commented Dec 15, 2022

You and me both. I've been using multiple other online textbooks to try and gain any kind of fundamental understanding of this material. I don't usually struggle with things like this, but nothing makes me feel more unintelligent than being tested over things we haven't even been taught yet.

  • Top Courses
  • Online Degrees
  • Find your New Career
  • Join for Free

University of Copenhagen

Air Pollution – a Global Threat to our Health

Taught in English

Some content may not be translated

Financial aid available

23,025 already enrolled

Gain insight into a topic and learn the fundamentals

Steffen Loft

Instructors: Steffen Loft +2 more

Instructors

Instructor ratings

We asked all learners to give feedback on our instructors based on the quality of their teaching style.

Coursera Plus

Included with Coursera Plus

(1,441 reviews)

Details to know

coursera r programming air pollution assignment

Add to your LinkedIn profile

See how employees at top companies are mastering in-demand skills

Placeholder

Earn a career certificate

Add this credential to your LinkedIn profile, resume, or CV

Share it on social media and in your performance review

Placeholder

There are 3 modules in this course

We all have to breathe to live. But the air we breathe is polluted both outdoors and indoors. Each year, this pollution costs 7 million lives across the globe – and a lot of suffering. 1 in 8 deaths is due to air pollution. This course will provide you with an introduction to the most recent research in the field of health effects of air pollution as well as a broader understanding of sources and spread of air pollution and what we should do about it.

What is air pollution? What are the sources? How and where are we exposed outdoors and indoors? What happens in the body? Which diseases are the result? Who are the most vulnerable? How can we assess the effects of air pollution? And what should we do to reach the Sustainable Development Goal to “substantially reduce the number of deaths and illnesses from hazardous chemicals and air, water and soil pollution”? These are some of the important questions we will address in the course. During the course you will meet researchers and experts from the University of Copenhagen and the Technical University of Denmark. They work with different aspects of air pollution and health: toxicology, exposure assessment, epidemiology, engineering and health impact assessment. It is a global responsibility to combat the health impacts of air pollution, and this fight can only be won through new knowledge and global collaboration. We hope you will join us in the course and equip yourself to take part in this global and individual health challenge.

The air we breathe

The air we breathe is full of particles and gases. Some occur naturally, but many are the result of human activities. This first module will look into what air pollution is, where it comes from and what it does to our lungs and the rest of our body.

What's included

4 videos 4 readings 3 quizzes 1 discussion prompt

4 videos • Total 24 minutes

  • Steffen Loft: Introduction • 1 minute • Preview module
  • Peter Møller: Sources and Composition of Air Pollution • 7 minutes
  • Peter Moller: What Happens in the Lungs? • 7 minutes
  • Peter Moller: What Happens in the Rest of the Body? • 7 minutes

4 readings • Total 160 minutes

  • UN Sustainable Development Goals • 30 minutes
  • Want to know more? Air pollution sources • 60 minutes
  • Want to know more? Counseling patients using the Air Quality Health Index • 25 minutes
  • Want to know more? Emerging hazards and improved understanding of risk • 45 minutes

3 quizzes • Total 90 minutes

  • Sources and Composition of Air Pollution • 30 minutes
  • What Happens in the Lungs? • 30 minutes
  • What Happens in the Rest of the Body? • 30 minutes

1 discussion prompt • Total 45 minutes

  • Delhi – Sources and Solutions • 45 minutes

Outdoor air pollution

Outdoor air pollution affects all of us – no matter where we are on the Globe. But there are big differences in air pollution levels from one country to another, from rural to urban areas, from city to city, and even from one side of the street to the other. Though all people are affected, some people are more vulnerable to the damaging health effects of air pollution than others. This module will explain about how we can study health effects of exposure to outdoor air pollution in diverse population groups. We will also look at what we can do to fight outdoor pollution – and cope with it.

4 videos 1 reading 4 quizzes 2 discussion prompts

4 videos • Total 31 minutes

  • Zorana J. Andersen: Epidemiological Principles of Air Pollution • 7 minutes • Preview module
  • Zorana J. Andersen: Vulnerable Groups • 8 minutes
  • Zorana J. Andersen: The Global Burden • 7 minutes
  • Steffen Loft: What Can We Do about Outdoor Air Pollution? • 8 minutes

1 reading • Total 30 minutes

  • WHO: Urban Health • 30 minutes

4 quizzes • Total 120 minutes

  • Epidemiological Principles of Air Pollution • 30 minutes
  • Vulnerable Groups • 30 minutes
  • The Global Burden • 30 minutes
  • What Can We Do about Outdoor Air Pollution? • 30 minutes

2 discussion prompts • Total 75 minutes

  • What is the burden of air pollution in your country? • 45 minutes
  • What to do in your city? • 30 minutes

Indoor air pollution

Most people spend most of their time indoors. The building envelope traps and accumulates pollution from both indoor and outdoor sources. This module will explain about health effects of indoor use of solid fuel as a particularly important source in large parts of the world, as well as of other sources of indoor air pollution. You will also learn about what you can do to improve the air quality in your home.

2 videos 2 readings 2 quizzes 1 discussion prompt

2 videos • Total 20 minutes

  • Steffen Loft: Solid Fuel in Households • 8 minutes • Preview module
  • Steffen Loft: Tight Buildings • 12 minutes

2 readings • Total 60 minutes

  • WHO: Indoor Air Pollution • 30 minutes
  • EPA: Introduction to Indoor Air Quality • 30 minutes

2 quizzes • Total 60 minutes

  • Solid Fuel in Households • 30 minutes
  • Tight Buildings • 30 minutes

1 discussion prompt • Total 30 minutes

  • What can you do to improve the air quality in your home? • 30 minutes

coursera r programming air pollution assignment

The University of Copenhagen is the oldest University in Denmark - founded in 1479, and with over 38,000 students and more than 9,000 employees. The purpose of the University is to conduct research and provide education to the highest academic level. Based in Denmark's capital city it is one of the top research institutions in Europe.

Recommended if you're interested in Public Health

coursera r programming air pollution assignment

Google Cloud

Create Image Captioning Models - 繁體中文

coursera r programming air pollution assignment

Introduction to Image Generation - 繁體中文

coursera r programming air pollution assignment

Goldman Sachs

Les bases de la vente et du marketing avec Goldman Sachs 10,000 Women

coursera r programming air pollution assignment

Imperial College London

Tobacco Control: Agile Policy, Research and Practice

Why people choose coursera for their career.

coursera r programming air pollution assignment

Learner reviews

Showing 3 of 1441

1,441 reviews

Reviewed on Jun 19, 2023

It has really helped in understanding the effect of various gaseous pollutants on the health of humans. We should take appropriate measures to control for future generation.

Reviewed on May 24, 2020

very nice instructor and the course material. learned some of the very basic thing about pollution and health effects. i thank the instructor for this course

Reviewed on Sep 15, 2020

It's an excellent course in which you can know some facts and ideas about what is the great effect of pollution to all of us. That's why we should help one another to save our planet.

New to Public Health? Start here.

Placeholder

Open new doors with Coursera Plus

Unlimited access to 7,000+ world-class courses, hands-on projects, and job-ready certificate programs - all included in your subscription

Advance your career with an online degree

Earn a degree from world-class universities - 100% online

Join over 3,400 global companies that choose Coursera for Business

Upskill your employees to excel in the digital economy

Frequently asked questions

When will i have access to the lectures and assignments.

Access to lectures and assignments depends on your type of enrollment. If you take a course in audit mode, you will be able to see most course materials for free. To access graded assignments and to earn a Certificate, you will need to purchase the Certificate experience, during or after your audit. If you don't see the audit option:

The course may not offer an audit option. You can try a Free Trial instead, or apply for Financial Aid.

The course may offer 'Full Course, No Certificate' instead. This option lets you see all course materials, submit required assessments, and get a final grade. This also means that you will not be able to purchase a Certificate experience.

What will I get if I purchase the Certificate?

When you purchase a Certificate you get access to all course materials, including graded assignments. Upon completing the course, your electronic Certificate will be added to your Accomplishments page - from there, you can print your Certificate or add it to your LinkedIn profile. If you only want to read and view the course content, you can audit the course for free.

What is the refund policy?

You will be eligible for a full refund until two weeks after your payment date, or (for courses that have just launched) until two weeks after the first session of the course begins, whichever is later. You cannot receive a refund once you’ve earned a Course Certificate, even if you complete the course within the two-week refund period. See our full refund policy Opens in a new tab .

Is financial aid available?

Yes. In select learning programs, you can apply for financial aid or a scholarship if you can’t afford the enrollment fee. If fin aid or scholarship is available for your learning program selection, you’ll find a link to apply on the description page.

More questions

IMAGES

  1. R : coursera air pollution assignment

    coursera r programming air pollution assignment

  2. Air pollution assignment

    coursera r programming air pollution assignment

  3. Air Pollution

    coursera r programming air pollution assignment

  4. Programming Assignment 1 Instructions Air Pollution

    coursera r programming air pollution assignment

  5. Programming Assignment 1 INSTRUCTIONS Air Pollution Coursera

    coursera r programming air pollution assignment

  6. AIR POLLUTION ASSIGNMENT M.pdf

    coursera r programming air pollution assignment

VIDEO

  1. ggplot2 part 1 Johns Hopkins University Coursera

  2. NPTL Air Pollution and Control Assignment 7 Answer #nptel

  3. 11 weak assignment of air pollution and control of nptel

  4. Working with Color in R Plots part 4 Johns Hopkins University Coursera

  5. nptel air pollution and control assignment 2 2024

  6. assignment // air pollution #education #motivation #science #assignment

COMMENTS

  1. r

    coursera air pollution assignment. Ask Question Asked 8 years, 11 months ago. Modified 7 ... I'm new to programming and to R and still distant from getting any results when calling my function. There are many questions and answers about this coursera assignment in stack overflow but my review of these exchanges hasn't addressed the bug in my ...

  2. Atawua/R-Programming-Assignment1: Assignment 1

    R-Programming-Coursera. Assignment 1. "Part 1 - Pollutant Mean" Write a function named 'pollutantmean' that calculates the mean of a pollutant (sulfate or nitrate) across a specified list of monitors. The function 'pollutantmean' takes three arguments: 'directory', 'pollutant', and 'id'. Given a vector monitor ID numbers, 'pollutantmean' reads ...

  3. Programming Assignment 1: Air Pollution

    The zip file contains 332 comma-separated-value (CSV) files containing pollution monitoring data for fine particulate matter (PM) air pollution at 332 locations in the United States. Each file contains data from a single monitor and the ID number for each monitor is contained in the file name. For example, data for monitor 200 is contained in ...

  4. GitHub

    The zip file contains 332 comma-separated-value (CSV) files containing pollution monitoring data for fine particulate matter (PM) air pollution at 332 locations in the United States. Each file contains data from a single monitor and the ID number for each monitor is contained in the file name.

  5. Coursera: R programming Week 2 Assignment

    Coursera: R programming Week 2 Assignment Lingyun Gao ... This is common with air pollution monitoring data in the United States. Part 1. Write a function named 'pollutantmean' that calculates the mean of a pollutant (sulfate or nitrate) across a specified list of monitors. The function 'pollutantmean' takes three arguments ...

  6. Air Pollution Data Analysis with R functions

    For this first programming assignment you will write three functions that are meant to interact with dataset that accompanies this assignment. The dataset is contained in a zip file specdata.zip that you can download from the Coursera web sit ... files containing pollution monitoring data for fine particulate matter (PM) air pollution at 332 ...

  7. Assignment.1 (Coursera-D.S: R programming)

    Assignment.1 (Coursera-D.S: R programming) Ahmed Tadde May 8, 2015 ... files containing pollution monitoring data for fine particulate matter (PM) air pollution at 332 locations in the United States. Each file contains data from a single monitor and the ID number for each monitor is contained in the file name. For example, data for monitor 200 ...

  8. R Programming

    Programming Assignment 1 INSTRUCTIONS: Air Pollution ... We have now entered the third week of R Programming, which also marks the halfway point. The lectures this week cover loop functions and the debugging tools in R. These aspects of R make R useful for both interactive work and writing longer code, and so they are commonly used in practice ...

  9. Coursera-R-Programming/Air-Pollution-Assignment-3 at master

    Using R For Effective Data Analysis. Contribute to sjung-stat/Coursera-R-Programming development by creating an account on GitHub.

  10. RPubs

    R Pubs by RStudio. Sign in Register [Programming Assignment 1] R Programming; by Anderson Hitoshi Uyekita; Last updated almost 2 years ago; Hide Comments (-) Share Hide Toolbars

  11. R Programming: Air Pollution

    Assignment Part 1: Write a function named 'pollutantmean' that calculates the mean of a pollutant (sulfate or nitrate) across a specified list of monitors. The function 'pollutantmean' takes three arguments: 'directory', 'pollutant', and 'id'. Given a vector monitor ID numbers, 'pollutantmean' reads that monitors' particulate matter data from ...

  12. Josiah Parry

    The assignment utilizes a directory of data called specdata which can be downloaded here, and describes it: The zip file contains 332 comma-separated-value (CSV) files containing pollution monitoring data for fine particulate matter (PM) air pollution at 332 locations in the United States.

  13. R Programming

    Programming Assignment 1 INSTRUCTIONS: Air Pollution ... We have now entered the third week of R Programming, which also marks the halfway point. The lectures this week cover loop functions and the debugging tools in R. These aspects of R make R useful for both interactive work and writing longer code, and so they are commonly used in practice ...

  14. Coursera's R Programming Assignment 1

    So the higher level stuff is done next we break the problem into steps. read the files all the data files. merge the data files in one data frame. ignore the NAs. subset the data frame by pollutant. calculate the mean. Lets find out what the mean function requires.

  15. GitHub

    R programming - MOOC Coursera - Johns Hopkins University Programming Assignment 1: Air Pollution: InstructionsHelp Center Introduction For this first programming assignment you will write three functions that are meant to interact with dataset that accompanies this assignment.

  16. R Programming Week 2: Assignment 1

    Quiz. Q1. What value is returned by the following call to pollutantmean()? You should round your output to 3 digits. pollutantmean("specdata", "sulfate", 1:10)

  17. Coursera

    R Beginner Book Recommendations:=====1. R: Easy R Programming for Beginners: http://amzn.to/2dbTW3q2. Free e...

  18. R Programming Assignment 1: Air Pollution // 小默的博客

    This is common with air pollution monitoring data in the United States. Part 1. Write a function named 'pollutantmean' that calculates the mean of a pollutant (sulfate or nitrate) across a specified list of monitors. The function 'pollutantmean' takes three arguments: 'directory', 'pollutant', and 'id'.

  19. R Programming Programming Assignment 1 (Week 2) John Hopkins Data

    For this first programming assignment you will write three functions that are meant to interact with dataset that accompanies this assignment. The dataset is contained in a zip file specdata.zip that you can download from the Coursera web site. Although this is a programming assignment, you will be assessed using a separate quiz.

  20. Air Pollution R basic examples from Coursera R Programming Assignment 1

    Air Pollution R basic examples from Coursera R Programming Assignment 1 - antoniovassell/Air-Pollution

  21. GitHub

    pollutantmean.R. This file contains the function named 'pollutantmean' that calculates the mean of a pollutant (sulfate or nitrate) across a specified list of monitors. The function 'pollutantmean' takes three arguments: 'directory', 'pollutant', and 'id'. The function then reads the particulate matter data for the ...

  22. Air Pollution

    There are 3 modules in this course. We all have to breathe to live. But the air we breathe is polluted both outdoors and indoors. Each year, this pollution costs 7 million lives across the globe - and a lot of suffering. 1 in 8 deaths is due to air pollution. This course will provide you with an introduction to the most recent research in the ...

  23. GitHub

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window.