100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
MGG Exam 8 oct . 19/35 Questions and Answers A+ Rated £8.34   Add to cart

Exam (elaborations)

MGG Exam 8 oct . 19/35 Questions and Answers A+ Rated

 2 views  0 purchase

MGG Exam 8 oct . 19/35 Questions and Answers A+ Rated

Preview 2 out of 7  pages

  • September 27, 2024
  • 7
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
All documents for this subject (1)
avatar-seller
Victorious23
MGG Exam 8 oct . 19/35 Questions
and Answers A+ Rated
what does a conditional statement set - - first sets a condition, then a
consequent action

-condition
-action
-other

if(condition){
action statement
}else{
second action statement
}

- curly braces surround - - each action statement

- example of conditional statement with Bactcount - - 1. set up empty
vector to hold inputted values that conditional statement feeds
BactCount <- c()
2. load sample
Sample<- 110

if (Sample>50){
BactCount <- append(BactCount, Sample)
}else{
BactCount <- append(BactCount, 0)
}


BactCount
[1] 110


If sample was less than 50, would have added zero

- How do you test for more than one condition? - - use
else if


how do you show greater than or Equal to?

else if (120<=systolicData & systolicData < 130)

, this is asked if the number is greater than or equal to 120 AND less than 130


what do you use at the end of conditional statements

else
(for all other data that doesn't fit any of the other parameters)

- What does a For Loop allow you to do? - - lets you perform an action on
every element in your vector. You do this "interactively" or element by
element

you assign the element to a temporary variable and then use this variable in
the action statement

- how do you format a for loop? - - vector1 <- c(1,2,3,4,5)
for (i in vector1){
a<- 2*i
print(a)
}

prints all the numbers where the value was multiplied by 2 for each value in
the vector


-can do the same thing w BactCount example, only difference is load all
values into Samples
and then code is
for ( i in samples){
if .....

- what is a function? - - a function is a block of code that you can apply with
a single word no matter how long it is

example is R function "sum"

- How do you create your own functions? - - FunctionName <-
function(argument1, argument2, etc.){
block of code
}

block of code- usually something like
print(argument1/argument2)
this would be for the divide function since the arguments are dividing

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Victorious23. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for £8.34. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

81633 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy revision notes and other study material for 14 years now

Start selling
£8.34
  • (0)
  Add to cart