Tech tips, tricks, how-tos and new products

Coursera: r programming week 3 tips.

May 1, 2015 amida168 Programing 0

The week 3’s assignment is the easiest one. If you can figure out the sample program provided, the solution is very similar to the sample code. You only need to replace a few strings to get your assignment done.

Someone in the class forum wrote a small program to verify the assignment. I have modified it and here is the listing. BTW, I do not have access to the forum any more and I do not know who is the original author. If you are the original author, please let me know and I’ll mention your name in this post. Once you are done coding, put this code in the same directory and source it. # Test your code source("cachematrix.R") # # generate matrix, and the inverse of the matrix. size mymatrix mymatrix.inverse # # now solve the matrix via the cache-method # special.matrix # # this should take long, since it's the first go print("Solving the matrix for the first time.") time1 special.solved.1 time2 print(time2 - time1) # # this should be lightning fast print("Solving the matrix for the second time.") time1 special.solved.2 time2 print(time2 - time1) # # check if all solved matrices are identical print(identical(mymatrix.inverse, special.solved.1)) print(identical(mymatrix.inverse, special.solved.2)) # # should return TRUE

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Be the first to comment

Leave a reply cancel reply.

Copyright © 2024 | WordPress Theme by MH Themes

Social Widgets powered by AB-WebLog.com .

r programming assignment week 3

  • R Programming Week 3 Programming Assignments 2: Lexical Scoping
  • by Louis Stanley
  • Last updated over 1 year ago
  • Hide Comments (–) Share Hide Toolbars

Twitter Facebook Google+

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

Navigation Menu

Instantly share code, notes, and snippets.

@psgganesh

psgganesh / assignment3.md

  • Download ZIP
  • Star 0 You must be signed in to star a gist
  • Fork 0 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 psgganesh/add9c2d5aadf500f659656053a7104cf to your computer and use it in GitHub Desktop.

R Programming Project 3

github repo for rest of specialization: Data Science Coursera

The zip file containing the data can be downloaded here: Assignment 3 Data

Part 1 Plot the 30-day mortality rates for heart attack ( outcome.R )

r programming assignment week 3

Part 2 Finding the best hospital in a state ( best.R )

Part 3 ranking hospitals by outcome in a state ( rankhospital.r ), part 4 ranking hospitals in all states ( rankall.r ).

R programming Assignment 3 week 4

Course 2 r programming, assignment 3 (week 4), under data science by johns hopkins university, 1 plot the 30-day mortality rates for heart attack, 3 ranking hospitals by outcome in a state, 4 ranking hospitals in all states.

Assignment 1: Project Proposal

Due: Tuesday, April 23rd, 2024 at 7PM

This quarter, you're going to reimplement an open-source research system in Rust, trying to achieve similar performance on one or more key metrics. You'll explore and come to understand what makes this easy or hard, and report on your experiences. The overall goal of this assignment is to help start to answer the question:

“What are the most important open research challenges for software systems written in Rust?”

There are three major milestones to your project:

Propose a team and project

Submit a midterm report in Week 6

Write up and submit your results

When you're done with this assignment, you should have

formed a team,

agreed on a system you will re-implement in Rust,

decided on 2-3 key performance metrics you will try to match.

1 Forming a Team

Your team should be 2-4 people, of which at least one, if possible, should have significant prior Rust experience. You can expect that this team member (or members) will spend a good deal of time helping the other team members as they become more familiar with the language. This is an important responsibility, and absolutely a valued intellectual goal of the class; one adage is that the best way to learn something is to teach it, as you need to not only understand it but also be able to explain that understanding.

Your team should explicitly select who will take on two different roles in the project. These people are responsible for this aspect of your project and should have the final say. Having a consistent approach to each is important. Plus by placing this responsibility in one person, they know to keep track of the issues in play and spend some of their time and thought on it. The two roles are:

Software architect : This is the person who will decide how to decompose your project into modules and what the interfaces to those modules are. In Rust terminology, this is means deciding on the structs, enums, and traits, especially the public ones. Of course these will evolve as the project progresses. But the software architect has the design in their head and knows how it comes together. Two people working on different modules that interact through a trait can suggest changes to the architect (e.g., to support a piece of functionality), but it's ultimately up to the architect to sign off on a change.

Project manager : This is the person who decides who works on what and when. They are the person who is ultimately responsible for the system working at the end of the quarter. If development is falling behind, the project manager is the person who decides when to ask one person to stop working on one module, or set a partial completion point, before they shift to work on another. Put anothjer way, the project manager decides how to allocate the programming time of the team.

These two roles should have a single owner because, for both of them, having a consistency in approach is often more important than optimizing the exact approach taken. There are many good software architectures to solve a problem: it's more important that you pick one and stick with it than exactly which (of the good ones) you pick. Similarly, there are many good ways to allocate people to complete a project: what's important is that you pick one strategy and stick with it.

Setting Expectations

As you form your team, you should meet in person and answer the following questions:

What are your goals for the class? Please have each member discuss individually.

What is your Rust background? What parts of it do you find harder or easier?

What are some computer systems research papers you've read that you liked?

How do you like to work? Do you prefer to work solo and occasionally sync up? Do you like pair programming?

Find a Time to Meet

Compare your schedules to find two time blocks of at least one hour each week when you all can meet. Commit to meeting at these times each week and working together. If something comes up and someone can't make it, be sure to schedule another time for that week. The purpose of these meetings is to keep everyone in regular, scheduled communication on progress, discuss each other's code, etc.

Be sure to set up a Slack channel (or any other communication medium you prefer) for lower-latency, low-bandwidth communication and coordination.

Set up a repository on GitLab

Go to Stanford's GitLab and set up a repository for your project. Add all of your team memebrs and the course staff as contributors. Write a README that describes your team and the project.

2 Choosing a System and Metrics

Pick an open-source research system that is open source and not written in Rust. This system should be something that you can run and reimplement without requiring specialized hardware: you'll need to be able to run both the open source and your version. We can probably get access to small amounts of cloud compute (e.g., if you want to run on high-core processors), but not 100-node clusters. Note that you do not need to recreate the evaluation setups in papers on the system. E.g., if you are re-implementing a transaction processing system that was evaluated on a server with 52 cores and 1TB of RAM, you can evaluate it on your laptop and gather meaningful results.

Your goal will be to reimplement the system – or at least part of it – in Rust, and compare the performance of your Rust implementation with the published one. You should pick 2-3 key performance results (e.g., latency under increasing load, throughput under increasing parallelism, etc.). Your goal will be to meet or exceed the results on these metrics. Writing slow code is easy: the challenges often come into play when you are forced to take particular approaches in order to minimize overheads (e.g., don't just Copy everything).

The system in question should be large and complex enough to be a substantial challenge. You have source code to refer to, which will help a good deal. A rough rule of thumb is it should be at least 1,000 lines of code per team member.

Many research systems are too complex and nuanced to implement in a quarter, even with source code available. It's OK to reimplement part of the system, or one piece of it (e.g., the server, but not the client). If the project builds on libraries, you are welcome to reuse those libraries.

The goal of the project isn't the replication of the system itself. Rather, it's about forcing you to deal with programming challenges in building a real system that performs well. We're encouraging research systems not because they're research but because they have clear performance metrics to compare against. Furthermore, ACM replication badges provide the experimental setting for these measurements.

If you find an open source system or library that has a good benchmark setup with it, that is fine too. In that case, you can choose a benchmark rather than a result in the paper. Note that choosing the right benchmarks might allow you to implement only a small subset of the system.

In general, systems that are computationally bound (i.e., can you write a tight loop) are less interesting than I/O, in part due the complexities of memory management, concurrency, and the challenging things about Rust. Systems that have one or more of the following properties are a plus:

High computational parallelism with shared state

High network parallelism (requests per second, multi RTT exchanges)

Complex, interlocking data structures

The Rust async metanarrative has some good examples of things that are difficult with asynchronous Rust code.

You should generally plan on > 1,000 lines of code per group member. Scope your project (e.g., which parts of the system you will reimplement) accordingly.

3 Some possible projects

S3FIFO : note it’s a simulator, so the evaluation will be the simulator itself, not the result

Trio : reimplement libfs

Tiptoe : use the existing crypto

Cuckoo Trie

Coeus : pick one of the 3 steps

FlexSpace, FlexTree, FlexDB

PashJIT : core part is the execution engine for shell scripts

Pocket : just run on one machine

Black Box NUMA

4 Handing In

Your proposal should be a 1 page document that states:

Who is in your team, and their Rust experience

Who your software architect and project manager is

Your GitLab repository

What system you will re-implement

A link to the open source for the system you will re-implement

Which performance metrics you will try to match; reference the paper and include the table, stated result, or a high-quality images of the figures.

Send an email to [email protected], with the subject “Team <NAME>”, attaching your proposal as a PDF. Your team name should be the system you are re-implementing.

Programming Assignment 3: Quiz >> R Programming

1. What result is returned by the following code?

  • CAROLINAS HOSPITAL SYSTEM
  • MCLEOD MEDICAL CENTER – DARLINGTON
  • MUSC MEDICAL CENTER
  • MARY BLACK MEMORIAL HOSPITAL
  • LAKE CITY COMMUNITY HOSPITAL
  • GRAND STRAND REG MED CENTER

2. What result is returned by the following code?

  • MAIMONIDES MEDICAL CENTER
  • NORTHERN DUTCHESS HOSPITAL
  • HOSPITAL FOR SPECIAL SURGERY
  • KINGSBROOK JEWISH MEDICAL CENTER
  • BROOKS MEMORIAL HOSPITAL
  • CROUSE HOSPITAL

3. What result is returned by the following code?

  • PROVIDENCE ALASKA MEDICAL CENTER
  • ALASKA NATIVE MEDICAL CENTER
  • YUKON KUSKOKWIM DELTA REG HOSPITAL
  • CENTRAL PENINSULA GENERAL HOSPITAL
  • CORDOVA COMMUNITY MEDICAL CENTER
  • MT EDGECUMBE HOSPITAL

4. What result is returned by the following code?

  • CATAWBA VALLEY MEDICAL CENTER
  • WAYNE MEMORIAL HOSPITAL
  • WAKEMED, CARY HOSPITAL
  • SPRUCE PINE COMMUNITY HOSPITAL
  • CAROLINAS MEDICAL CENTER-NORTHEAST
  • THOMASVILLE MEDICAL CENTER

5. What result is returned by the following code?

  • YAKIMA VALLEY MEMORIAL HOSPITAL
  • KENNEWICK GENERAL HOSPITAL
  • ST ANTHONY HOSPITAL
  • KADLEC REGIONAL MEDICAL CENTER
  • JEFFERSON HEALTHCARE HOSPITAL
  • TACOMA GENERAL ALLENMORE HOSPITAL

6. What result is returned by the following code?

  • WEST HOUSTON MEDICAL CENTER
  • SETON SMITHVILLE REGIONAL HOSPITAL
  • MEMORIAL HERMANN NORTHEAST
  • PROVIDENCE MEMORIAL HOSPITAL
  • UNIVERSITY OF TEXAS HEALTH SCIENCE CENTER AT TYLER
  • SCENIC MOUNTAIN MEDICAL CENTER

7. What result is returned by the following code?

  • FOREST HILLS HOSPITAL
  • NASSAU UNIVERSITY MEDICAL CENTER
  • BELLEVUE HOSPITAL CENTER
  • UNIVERSITY HOSPITAL S U N Y HEALTH SCIENCE CENTER
  • FLUSHING HOSPITAL MEDICAL CENTER
  • ADIRONDACK MEDICAL CENTER

8. What result is returned by the following code?

  • NORTH COUNTRY HOSPITAL AND HEALTH CENTER
  • CASTLE MEDICAL CENTER
  • SANFORD USD MEDICAL CENTER
  • ST FRANCIS MEDICAL CENTER
  • PARKLAND HEALTH AND HOSPITAL SYSTEM
  • CLARK REGIONAL MEDICAL CENTER

9. What result is returned by the following code?

  • POTTSTOWN MEMORIAL MEDICAL CENTER
  • BERGEN REGIONAL MEDICAL CENTER
  • LAURENS COUNTY HEALTHCARE SYSTEM
  • TERREBONNE GENERAL MEDICAL CENTER
  • BAY AREA HOSPITAL
  • LAKES REGION GENERAL HOSPITAL

10. What result is returned by the following code?

  • HAWAII MEDICAL CENTER EAST
  • RENOWN SOUTH MEADOWS MEDICAL CENTER
  • CARY MEDICAL CENTER
  • CARONDELET ST JOSEPHS HOSPITAL
  • YORK GENERAL HOSPITAL

Related Questions & Answers:

  • Week 1 Quiz >> R Programming Week 1 Quiz >> R Programming 1. R was developed by statisticians working at Microsoft Johns Hopkins University The University ... Read more...
  • Week 2 Quiz >> R Programming Week 2 Quiz >> R Programming 1. Suppose I define the following function in R cube <- function(x, n) {         ... Read more...
  • Week 3 Quiz >> R Programming Week 3 Quiz >> R Programming 1. Take a look at the ‘iris’ dataset that comes with R. The data ... Read more...
  • Week 4 Quiz >> R Programming Week 4 Quiz >> R Programming 1. What is produced at the end of this snippet of R code? set.seed(1) ... Read more...
  • Programming Assignment 1: Quiz >> R Programming Programming Assignment 1: Quiz >> R Programming 1. What value is returned by the following call to pollutantmean()? You should ... Read more...
  • Graded Quiz: Functions, Sub-Queries, Multiple Tables Graded Quiz: Functions, Sub-Queries, Multiple Tables >> Databases and SQL for Data Science with Python 1.Which of the following queries ... Read more...

Leave a Comment Cancel reply

Save my name, email, and website in this browser for the next time I comment.

Please Enable JavaScript in your Browser to Visit this Site.

COMMENTS

  1. GitHub

    R-Programming-Assignment-Week-3. Introduction. This second programming assignment will require you to write an R function is able to cache potentially time-consuming computations. For example, taking the mean of a numeric vector is typically a fast operation. However, for a very long vector, it may take too long to compute the mean, especially ...

  2. Coursers R programming week 3 Assignment Submission and Program

    This video contains the code for programming assignment-3 and the step by step instructions for submission of assignment which includes forking, cloning repo...

  3. RPubs

    R Pubs by RStudio. Sign in Register R Programming - Week 3 Assignment; by Ken Wood; Last updated over 3 years ago; Hide Comments (-) Share Hide Toolbars

  4. R Programming Week 3 Programming Assignments 2: Lexical Scoping

    The following function calculates the mean of the special "vector" created with the above function. However, it first checks to see if the mean has already been calculated. If so, it gets the mean from the cache and skips the computation. Otherwise, it calculates the mean of the data and sets the value of the mean in the cache via the ...

  5. Week 3 Project Assignment

    This lesson is called Week 3 Project Assignment, part of the R in 3 Months (Spring 2024) course. If the video is not playing correctly, you can watch it in a new window . Transcript. Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

  6. R Programming

    We also introduce the first programming assignment for the course, which is due at the end of the week. What's included. 13 videos 3 readings 2 quizzes 3 programming assignments. Show info about module content. ... We have now entered the third week of R Programming, which also marks the halfway point. The lectures this week cover loop ...

  7. R Programming

    Week 1 Quiz • 30 minutes. 7 programming assignments • Total 1,260 minutes. swirl Lesson 1: Basic Building Blocks • 180 minutes. swirl Lesson 2: Workspace and Files • 180 minutes. swirl Lesson 3: Sequences of Numbers • 180 minutes. swirl Lesson 4: Vectors • 180 minutes. swirl Lesson 5: Missing Values • 180 minutes.

  8. Coursera: R Programming Week 3 Tips

    The week 3's assignment is the easiest one. If you can figure out the sample program provided, the solution is very similar to the sample code. You only need to replace a few strings to get your assignment done. Someone in the class forum wrote a small program to verify the assignment. I have modified it and here is the listing.

  9. Data Visualization Week 3 Programming Assignment 2

    This assignment uses R Programming Language to visualize data. Q1. What is the data that you chose? Why? Data from a voluntary association are used to construct a new formal model for a traditional anthropological problem, fission in small groups. The process leading to fission is viewed as an unequal flow of sentiments and information across ...

  10. Data Wrangling with R

    As a part of the week 3 assignment, I have scrapped the daily average weather data and done some basic exploratory analysis. Following are the finding: The temperatures have been increasing over the years. Colder months have a lot of variation in the temperature as compared to the colder months. Temperature typically vary between 0 to 90, with ...

  11. Week 3 Project Assignment

    This lesson is called Week 3 Project Assignment, part of the VSA R Training (Fall 2022) course. If the video is not playing correctly, you can watch it in a new window . Transcript. Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

  12. R Programming

    RPubs. by RStudio. Sign inRegister. Ryan Tillis - R Programming - Data Science - Quiz 3 - Coursera. by Ryan Tillis. Last updatedover 7 years ago. HideComments(-)ShareHide Toolbars. ×. Post on:

  13. R Programming Week 3 Programming Assignments 2: Lexical Scoping

    Sign inRegister. R Programming Week 3 Programming Assignments 2: Lexical Scoping. by Louis Stanley. Last updatedover 1 year ago. HideComments(-)ShareHide Toolbars. ×. Post on: TwitterFacebookGoogle+. Or copy & paste this link into an email or IM:

  14. R Programming Programming Assignment 3 (Week 4) John Hopkins Data

    R Programming Project 3 github repo for rest of specialization: Data Science Coursera The zip file containing the data can be downloaded here: Assignment 3 Data

  15. Week 3 Quiz >> R Programming

    Week 3 Quiz >> R Programming. 1. Take a look at the 'iris' dataset that comes with R. The data can be loaded with the code: A description of the dataset can be found by running. There will be an object called 'iris' in your workspace. In this dataset, what is the mean of 'Sepal.Length' for the species virginica? Please round your ...

  16. R programming Assignment 3 week 4

    R programming Assignment 3 week 4 Fan Ouyang 8/21/2017. Course 2 R Programming, Assignment 3 (Week 4), under Data Science by Johns Hopkins University. 1 Plot the 30-day mortality rates for heart attack

  17. Assignment 1: Project Proposal

    The overall goal of this assignment is to help start to answer the question: "What are the most important open research challenges for software systems written in Rust?" There are three major milestones to your project: Propose a team and project. Submit a midterm report in Week 6. Write up and submit your results. Goals

  18. Programming Assignment 3: Quiz >> R Programming

    Programming Assignment 3: Quiz >> R Programming 1. What result is returned by the following code? best ("SC", "heart attack") CAROLINAS HOSPITAL SYSTEMMCLEOD MEDICAL CENTER - DARLINGTONMUSC MEDICAL CENTERMARY BLACK MEMORIAL HOSPITALLAKE CITY COMMUNITY HOSPITALGRAND STRAND REG MED CENTER 2. What result is returned by the following code? best ...