Preview

Practice Assignment 1

Powerful Essays
Open Document
Open Document
2761 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Practice Assignment 1
Practice Assignment
The goal of this assignment is to provide a “bridge” between the first two weeks of lectures and assignment 1 for those either new to R or struggling with how to approach the assignment.
This guided example, will not provide a solution for programming assignment 1. However, it will guide you through some core concepts and give you some practical experience to hopefully make assignment 1 seems less daunting.
To begin, download this file and unzip it into your R working directory. http://s3.amazonaws.com/practice_assignment/diet_data.zip You can do this in R with the following code: dataset_url <- "http://s3.amazonaws.com/practice_assignment/diet_data.zip" download.file(dataset_url, "diet_data.zip") unzip("diet_data.zip", exdir = "diet_data")
If you’re not sure where your working directory is, you can find out with the getwd() command. Alternatively, you can view/change it through the Tools > Global Options menu in R Studio.
So assuming you’ve unzipped the file into your R directory, you should have a folder called diet_data. In that folder there are five files. Let’s get a list of those files: list.files("diet_data") ## [1] "Andy.csv"

"David.csv" "John.csv"

"Mike.csv"

"Steve.csv"

Okay, so we have 5 files. Let’s take a look at one to see what’s inside: andy <- read.csv("diet_data/Andy.csv") head(andy) ##
##
##
##
##
##
##

1
2
3
4
5
6

Patient.Name Age Weight Day
Andy 30
140
1
Andy 30
140
2
Andy 30
140
3
Andy 30
139
4
Andy 30
138
5
Andy 30
138
6

It appears that the file has 4 columns, Patient.Name, Age, Weight, and Day. Let’s figure out how many rows there are by looking at the length of the ‘Day’ column: length(andy$Day) ## [1] 30
30 rows. OK.
Alternatively, you could look at the dimensions of the data.frame:

1

dim(andy)
## [1] 30

4

This tells us that we 30 rows of data in 4 columns. There are some other commands we might want to run to get a feel for a new data file, str(), summary(), and names(). str(andy) ## 'data.frame':
## $

You May Also Find These Documents Helpful

  • Satisfactory Essays

    POS 420 Week 4 DQs

    • 549 Words
    • 4 Pages

    Complete the University of Phoenix Material: File Processing Commands Worksheet located on your student website.…

    • 549 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    POS 420 Week 5 UNIX Paper

    • 541 Words
    • 4 Pages

    Complete the University of Phoenix Material: File Processing Commands Worksheet located on your student website.…

    • 541 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    Assignment 1

    • 872 Words
    • 4 Pages

    The IP addresses defined in a DHCP scope must be contiguous and are associated with a subnet mask. If the addresses you want to assign are not contiguous, you must create a scope encompassing all the addresses you want to assign and then exclude specific addresses or address ranges from the scope. So just be sure to check how you have your DHCP…

    • 872 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    Assignment 1

    • 1774 Words
    • 19 Pages

    Aims for Assignments 1 and 2: Through these question answer based assignments, you will learn the process of…

    • 1774 Words
    • 19 Pages
    Powerful Essays
  • Satisfactory Essays

    assignment 1

    • 636 Words
    • 3 Pages

    b. What type of good or service is this company best known for? (1.0 points…

    • 636 Words
    • 3 Pages
    Satisfactory Essays
  • Better Essays

    Essay#3 Waters Denise

    • 1009 Words
    • 5 Pages

    2. What did you learn from completing this assignment? Did you experience a new understanding of the topic? Did you change your perspective after completing the research?…

    • 1009 Words
    • 5 Pages
    Better Essays
  • Better Essays

    Assignment 1

    • 6548 Words
    • 27 Pages

    You will notice that you need to look in different course books for some of the information and not all unit evidence correspond to the matching unit number…

    • 6548 Words
    • 27 Pages
    Better Essays
  • Satisfactory Essays

    Assignment 1

    • 352 Words
    • 3 Pages

    2. Use the table below to describe some of the different types and styles of documents that are produced in a business environment, and then explain when these different options may be used.…

    • 352 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Assignment 1

    • 464 Words
    • 2 Pages

    In 300-500 words, write a summary of your job exploration and respond to the following:…

    • 464 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Assignment 1

    • 862 Words
    • 4 Pages

    Due: Assignment 1 is to be done when you have completed the readings for Unit 5 of the course.…

    • 862 Words
    • 4 Pages
    Powerful Essays
  • Good Essays

    Assignment 1

    • 883 Words
    • 4 Pages

    Up to the age of 3 months a baby will only be able to lie on its back. At around 3 months baby will start lifting their head and kicking their legs vigorously, they will also recognise the face of their main carer as well as bright lights and loud noises. As time passes they will be able to hold objects and transfer them from hand to hand, they will also attempt to put things in their mouth. Mobility usually sets in around 9-12 months. They will be able to sit unaided and will get around by either rolling, crawling, shuffling or possibly walking unaided. They will also have learnt how to throw objects. At 1 year although mobile they will still find balancing difficult but most children of this age will be able to kneel without support and climb stairs with supervision. At 2 years children will be able to walk, run and kick and throw a ball although they may not be confident at catching.…

    • 883 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    assignment 1

    • 1442 Words
    • 6 Pages

    1. Describe two examples of important things that financial planning skills can help you do, and explain why these things are important to you personally. (4-6 sentences. 2.0 points)…

    • 1442 Words
    • 6 Pages
    Powerful Essays
  • Better Essays

    Assignment 1

    • 1535 Words
    • 7 Pages

    Despite the fact that United States is the most affluent country in the world, a significant portion of its citizens have inadequate access to medical care. The barriers to obtaining health care are numerous; perhaps the most difficult hurdle to overcome is the lack of financial resources to pay for it. But the problem of lack of access to health cares for large segments of the population. The largest barrier to obtaining needed care is the lack of financial means to obtain it. The uninsured the underinsured cannot be stereotyped for they include many people who are employed, the elderly, children, minorities, person with handicaps, pregnant women, and other vulnerable populations. A lack of insurance does not translate in some cases to a lack of access to medical care, but it does have a clear impact upon access of health care.…

    • 1535 Words
    • 7 Pages
    Better Essays
  • Powerful Essays

    Assignment 1

    • 1144 Words
    • 5 Pages

    This assignment is based on personality and communication. This assignment discusses my personality type through self reflection and working style. I also will be discussing key communication techniques I use throughout my life. As well as my communication style. This is a summary of who I am and how I communicate with the world around me on a daily basis.…

    • 1144 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    3) use cast --> to group data in the most "square" format as possible, this…

    • 9371 Words
    • 38 Pages
    Satisfactory Essays

Related Topics