Question

Use R to solve these problems

8. The year is divided into four seasons: spring, summer, fall and winter While the exact dates that the seasons change vary

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please give thumbs up if you find it helpful. Let me now if you have any doubt.

Answer 8)

month=readline(prompt="Enter the month name: ")

if(month %in% c('March','April','May')){
print('Season is Spring')
}else if(month %in% c('June','July','August')){
print('Season is Summer')
}else if(month %in% c('September','October','November')){
print('Season is Fall')
}else if(month %in% c('December','January','February')){
print('Season is Winter')
}else{
print('You have entered a wrong month!')
}

Answer 9)

array <- c(11,23,58,31,56,77,43,12,65,19)
n=3

for (j in (length(array)-1):1) {
for (i in j:(length(array)-1)) {
if (array[i] < array[i+1]) {
temp <- array[i]
array[i] <- array[i+1]
array[i+1] <- temp
}
}
}

print(array[3]) #print the nth largest element

Output:

8.

Source on Save 1 month-readline (prompt-Enter the month name: ) 3- 4 print(Season is Spring 5. 6 print( Season is Summer

9.

1 2 arrayc(11,23,58,31,56,77,43,12,65,19) 4 5 for (j in Clength(array)-1):1) 6- for (i in j: Clength(array)-1)I if (array[i<

Add a comment
Know the answer?
Add Answer to:
Use R to solve these problems 8. The year is divided into four seasons: spring, summer,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question #7. (8 points) (P313) The following algorithm yields the season (Spring, Summer, Fall or Winter)...

    Question #7. (8 points) (P313) The following algorithm yields the season (Spring, Summer, Fall or Winter) for a given month and day. If month is 1, 2, or 3, season "Winter Else if month is 4, 5, or 6, season "Spring" Else if month is 7, 8, or 9, season "Summer Else if month is 10, 11, or 12, season "Fall" If month is divisible by 3 and day 21 If season is winter, season = "Spring" Else if season...

  • BUSINESS ANALYTICS Late in the summer, before the start of the school year, you decide to...

    BUSINESS ANALYTICS Late in the summer, before the start of the school year, you decide to make a quick phone call to your old college roommate Jeremy Hertz, who now lives in Aspen, Co where he runs a ski-equipment shop. “I love living in a ski town”, says Jeremy. It’s great here all year round! Why don’t you come for Labor Day weekend? It’ll be beautiful, we can do some hiking and eat in all the good restaurants before they...

  • BUSINESS ANALYTICS Late in the summer, before the start of the school year, you decide to...

    BUSINESS ANALYTICS Late in the summer, before the start of the school year, you decide to make a quick phone call to your old college roommate Jeremy Hertz, who now lives in Aspen, Co where he runs a ski-equipment shop. “I love living in a ski town”, says Jeremy. It’s great here all year round! Why don’t you come for Labor Day weekend? It’ll be beautiful, we can do some hiking and eat in all the good restaurants before they...

  • Trouble Is Afoot Josh's favorite times of the year were summer and fall. Not because of...

    Trouble Is Afoot Josh's favorite times of the year were summer and fall. Not because of humid heat or autumn's blazing color, but for the sports! Josh was a thr athlete. He seamlessly transitioned from summer swim league through basebal in each sport. This was an especially impressive accomplishment for a boy diag his and into football. Josh was not only a versatile athlete, but he also tru nosed with Type I diabetes at age seven. Now, a 17-year-old high...

  • Code is in C# Your instructor would like to thank to Marty Stepp and Hélène Martin...

    Code is in C# Your instructor would like to thank to Marty Stepp and Hélène Martin at the University of Washington, Seattle, who originally wrote this assignment (for their CSE 142, in Java) This program focuses on classes and objects. Turn in two files named Birthday.cs and Date.cs. You will also need the support file Date.dll; it is contained in the starter project for this assignment. The assignment has two parts: a client program that uses Date objects, and a...

  • I have this case study to solve. i want to ask which type of case study...

    I have this case study to solve. i want to ask which type of case study in this like problem, evaluation or decision? if its decision then what are the criterias and all? Stardust Petroleum Sendirian Berhad: how to inculcate the pro-active safety culture? Farzana Quoquab, Nomahaza Mahadi, Taram Satiraksa Wan Abdullah and Jihad Mohammad Coming together is a beginning; keeping together is progress; working together is success. - Henry Ford The beginning Stardust was established in 2013 as a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT