# STAT 540 UC Statistics Creating a Function Pointslines Questions

Important notes:
(1) for each problem, after you’ve created your final function, provide me with a printout of the
function statements and the created plot(s). DO NOT GIVE ME A SCREEN SHOT of the
function commands. Type its name at the prompt (without parentheses) and the function
commands will appear; select and copy those commands as text and paste them into your
solutions. That way, the grader or I can easily copy your function commands to see if it
works.
(2) Do not accomplish programming tasks by writing lots and lots of if-then statements. if your
program does this or is similarly inefficient we may take a point deduction saying “Make the
computer do the work”.
1. (10 points) Create a function pointslines() with no arguments that constructs the point-andline-types figure shown in section 11.2 of the R Primer, except (IMPORTANT!!) add your
name to the title(s) for both plots.
2. (15 points) In the setting of problem 2 on hwk 2 (the DL enrollments barplot), let’s write a
function called make.DLplot() whose purpose is to make a similar plot in later years,
adapting to new data as it becomes available for an annual report. I’ve started it for you:
function (enrollments) {
# enrollments: numeric vector of DL headcounts by term
# starting Fall 1999
}
Add statements to this function, after the comment, to do the following. After doing each step
below, save the function and check to see if the added command(s) worked. Don’t give me the
intermediate versions, just your final (most successful) function, and at least one plot showing a
successful test run.
a) determine the length of the enrollments vector (call it n)
using only this n and the provided vector enrollments:
b) make the barplot (hint: names.arg=1:n)
c) determine the last term for which enrollments are provided, as either Fall, Spring, or
Summer. (hint: use n%%3, the remainder of n divided by 3)
d) determine the final year for which enrollments are provided. Hint: floor() )
e) place a legend at the topleft of the graph with the revised time range information (similar to
the barplot from hwk 2), e.g. From Fall 1999 to _____ _____. Hint: use paste(), which can
combine character strings with the values of any object(s), converting the latter to character
values.
STAT 540 Hwk 3 p.1
f) add an appropriate title, including your name
Your function must accomplish the task for any numeric enrollment vector passed to it,
without further information. To test your function, I suggest you use the original enrollment
vector from hwk 2 and add made-up numbers, e.g. check1 = c(enrollments,50) and then
> make.DLplot(check1). You might want to add 2, and then 3, values to make sure
your function gets the correct term and year in the legend.
3. (15 points): Modify the function poker() from Ch. 12 of the Primer to a function called
bridge() which deals 13 cards instead of 5. The function should also count the hand’s points
as follows.
a. Highcard.points: score 4 points for each Ace in the hand, 3 points for each King, 2 points
for each Queen, and 1 point for each Jack (add these together). Hint:
table(myhand[,”denom”])
b. Distribution.points: score 3 points for each suit that has no cards in the hand (a “void”),
2 points for each suit that has only 1 card (a “singleton”), and 1 point for each suit that
has only two cards (a “doubleton”). Hint: table(myhand[,”suit”])
The function should return a list including the hand itself (a 13 by 2 data frame), the value of
Highcard.points, and the value of Distribution.points. After you’ve created the function and
checked it, provide me with a printout of the function and at least one example of its output
list.
Extra Credit problem (10 points): modify your function for problem 2 to so that the term
numbers on the horizontal axis are replaced by words “Fa99”, “Sp00”, “Su00” and so on. Make
these labels print perpendicular to the horizontal axis (hint: las). Test your function using the
hwk2 enrollment vector.
STAT 540 Hwk 3 p.2

Don't use plagiarized sources. Get Your Custom Essay on
STAT 540 UC Statistics Creating a Function Pointslines Questions
Just from \$13/Page
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

## Calculate the price of your order

Total price:
\$0.00

How it works?

Follow these simple steps to get your paper done

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

## Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.